一、准備
采用淘寶鏡像,下載速度快
npm config set registry https://registry.npm.taobao.org
二、全局安裝新版vue cli
cnpm install @vue/cli -g
三、因為需要sass,所以在需要生成項目的目錄下執行如下命令,注意此處的目錄不是項目目錄,而是其父目錄
3.1
cnpm install --global --production windows-build-tools //安裝一次即可
3.2 npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
執行后會出現“node_modules”目錄和package-lock.json文件
否則會出現“Error: Can't find Python executable "python", you can set the PYTHON env variable”
四、生成項目,並選擇手動配置
在當前目錄執行 vue create shieh
4.1
4.2 選擇如下內容
4.3
4.4 輸入“y”
4.6
4.7
4.8
4.9
4.10 輸入“n”
完整的輸出如下:
Vue CLI v4.5.3 ✨ Creating project in D:\work\web\vue\shieh. � Initializing git repository... ⚙️ Installing CLI plugins. This might take a while... > yorkie@2.0.0 install D:\work\web\vue\shieh\node_modules\yorkie > node bin/install.js setting up Git hooks done > core-js@3.6.5 postinstall D:\work\web\vue\shieh\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > ejs@2.7.4 postinstall D:\work\web\vue\shieh\node_modules\ejs > node ./postinstall.js added 1241 packages from 919 contributors in 103.849s 50 packages are looking for funding run `npm fund` for details � Invoking generators... � Installing additional dependencies... > node-sass@4.14.1 install D:\work\web\vue\shieh\node_modules\node-sass > node scripts/install.js Cached binary found at C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.14.1\win32-x64-72_binding.node > node-sass@4.14.1 postinstall D:\work\web\vue\shieh\node_modules\node-sass > node scripts/build.js Binary found at D:\work\web\vue\shieh\node_modules\node-sass\vendor\win32-x64-72\binding.node Testing binary Binary is fine added 147 packages from 100 contributors in 19.235s 56 packages are looking for funding run `npm fund` for details ⚓ Running completion hooks... � Generating README.md... � Successfully created project shieh. � Get started with the following commands: $ cd shieh $ npm run serve WARN Skipped git commit due to missing username and email in git config. You will need to perform the initial commit yourself.