Windows 下Npm和NodeJS公升級

2022-03-14 05:07:25 字數 1445 閱讀 7363

前提電腦中已經安裝過nodejs, npm。現在需要進行公升級操作。

1、檢視當前的npm和nodejs的版本:

c:\users\administrator>node -v

v4.4.3

c:\users\administrator>npm -version

2.15.1

2、公升級npm:

c:\users\administrator>npm install npm -g

c:\program files\nodejs\node_global\npm -> c:\program files\nodejs\node_global\n

ode_modules\npm\bin\npm-cli.js

[email protected] c:\program files\nodejs\node_global\node_modules\npm

c:\users\administrator>npm -version

4.5.0

3、安裝全域性n模組:

c:\users\administrator>npm install -g n

npm err! code ebadplatform

npm err! notsup unsupported platform for [email protected]: wanted (current: )

npm err! notsup valid os:    !win32

npm err! notsup valid arch:  any

npm err! notsup actual os:   win32

npm err! notsup actual arch: x64

npm err! a complete log of this run can be found in:

npm err!     c:\program files\nodejs\node_cache\_logs\2017-05-02t02_08_33_861z-d

ebug.log

報錯哦,那執行下面的命令:

c:\users\administrator>npm install -g n --force

npm warn using --force i sure hope you know what you are doing.

c:\program files\nodejs\node_global\n -> c:\program files\nodejs\node_global\nod

e_modules\n\bin\n

c:\program files\nodejs\node_global

`-- [email protected]

4、公升級nodejs到最新版本:

公升級到最新穩定版本:

n stable

公升級到最新版本:

n latest

公升級到指定版本:

n 0.10.26

windows 下更新npm 和node

一 先說一下 npm 的更新 檢視自己的 npm 版本 npm v 檢視官方文件可知,使用命令 npm install npm latest g 會自動完成安裝 紅色箭頭所指表示安裝的新的 npm 的版本號,下面是一些包檔案。安裝好以後再查詢版本號,就變成 5.0.3 了。二 再說一下 node 的...

windows下npm預設路徑設定

windows下npm預設路徑設定 步驟一 設定路徑 1.設定npm安裝程式時的預設位置 npm config set prefix d nodejs node global 2.設定npm安裝程式時的快取位置 npm config set cache d nodejs node cache 3.在...

windows下node配置npm全域性路徑 踩坑

事情的起因是 koa要求v7.6.0以上的nodejs。但是window環境下公升級node不容易,試過npm install g n 和n stable等命令無效,而網上推薦的nvm並不支援windows,而nvm for windows 又要求先刪除node及相關配置,而且這個用於支援windo...