windows 安裝 nodejs

nodejs 下載地址 :

有兩個版本 一個是支持win7 的地址 一個是支持win8的地址
 

官方地址:https://nodejs.org/en/download/

win7 直接安裝版:https://nodejs.org/dist/v12.16.2/node-v12.16.2-x64.msi

win7 自己配置版:https://nodejs.org/dist/v12.16.2/node-v12.16.2-win-x64.zip

win8+ 安裝版:https://nodejs.org/dist/v14.0.0/node-v14.0.0-x64.msi

win8+ 配置版:https://nodejs.org/dist/v14.0.0/node-v14.0.0-win-x64.zip

msi版本 直接點擊下一步下一步即可 沒啥說的 就和exe是一樣的 操作

這裏重點說一下 自解壓 Windows Binary 版的安裝

解壓文件到D盤(建議您放到D盤 或者 E/F/)

配置環境變量:在環境變量 PATH 中加入

D:\node-v12.16.2-win-x64

然後運行 cmd

測試安裝結果 ,看到下邊的代表成功了

C:\Users\julong>node --version
v12.16.2

測試 npm

C:\Users\julong>npm -v
6.14.4

 

配置 緩存路徑和配置路徑

D:\node-v12.16.2-win-x64>npm config set cache "D:\node-v12.16.2-win-x64\node_cache"

D:\node-v12.16.2-win-x64>npm config set prefix "D:\node-v12.16.2-win-x64\node_global"

D:\node-v12.16.2-win-x64>

 

配置npm倉庫地址爲淘寶的倉庫地址

npm config set registry http://registry.npm.taobao.org/

地址測試命令:
C:\Users\julong>npm get registry
http://registry.npm.taobao.org/

如果您不想修改 使用淘寶的 你可以不用修改倉庫地址 當然你也可以 重新覆蓋下淘寶的地址

npm config set registry https://registry.npmjs.org/

國外的地址比較慢 建議用國內的吧 安裝完後 可以用 cnpm命令了

命令 :npm install -g cnpm --registry=https://registry.npm.taobao.org

C:\Users\julong>npm install -g cnpm --registry=https://registry.npm.taobao.org
D:\node-v12.16.2-win-x64\cnpm -> D:\node-v12.16.2-win-x64\node_modules\cnpm\bin\cnpm
+ [email protected]
added 685 packages from 953 contributors in 127.302s

 

安裝webpack  javascript打包工具

# 最新穩定版
npm install vue

npm install webpack -g

安裝vue-cli

關於舊版本 npm view @vue/cli versions --json

Vue CLI 的包名稱由 vue-cli 改成了 @vue/cli。 如果你已經全局安裝了舊版本的 vue-cli (1.x 或 2.x),你需要先通過 npm uninstall vue-cli -g 或 yarn global remove vue-cli 卸載它。

Node 版本要求

Vue CLI 需要 Node.js 8.9 或更高版本 (推薦 8.11.0+)。你可以使用 nvm 或 nvm-windows 在同一臺電腦中管理多個 Node 版本。

npm install -g @vue/cli
# OR
yarn global add @vue/cli
D:\>vue create vue-test


Vue CLI v4.1.0
┌───────────────────────────────────────
──┐
│                                         │
│   New version available 4.1.0 → 4.3.1   │
│    Run npm i -g @vue/cli to update!     │
│                                         │
└───────────────────────────────────────
──┘

? Please pick a preset: default (babel, eslint)


Vue CLI v4.1.0
✨  Creating project in D:\vue-test.
�  Initializing git repository...
⚙  Installing CLI plugins. This might take a while...


> [email protected] install D:\vue-test\node_modules\yorkie
> node bin/install.js

setting up Git hooks
done


> [email protected] postinstall D:\vue-test\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall D:\vue-test\node_modules\ejs
> node ./postinstall.js

added 1196 packages from 852 contributors and audited 25249 packages in 241.001s


40 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

�  Invoking generators...
�  Installing additional dependencies...

added 54 packages from 39 contributors and audited 25532 packages in 76.579s

42 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

⚓  Running completion hooks...

�  Generating README.md...

�  Successfully created project vue-test.
�  Get started with the following commands:

 $ cd vue-test
 $ npm run serve


D:\>

啓動

D:\>cd vue-test

D:\vue-test>npm run serve

> [email protected] serve D:\vue-test
> vue-cli-service serve

 INFO  Starting development server...
98% after emitting CopyPlugin

 DONE  Compiled successfully in 5354ms                                  13:00:36



  App running at:
  - Local:   http://localhost:8080/
  - Network: http://192.168.10.18:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

終止批處理操作嗎(Y/N)? y

D:\vue-test>

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章