簡體   English   中英

使用錯誤版本的 NPM 安裝節點

[英]Node installs with the wrong version of NPM

大家好,我之前發布了這個問題,但沒有回復。 我再次發帖希望能得到一些急需的答案。

我正在關注 NodeJS 的教程。 在教程中,它說“安裝這個版本的 npm 以跟隨”我做了,它是版本 5.5.1。

不幸的是,該版本與我的節點版本不兼容,所以我嘗試升級我的 npm 但它也不起作用。 所以大多數帖子都說要重新安裝我所做的 Node,但我仍然收到以下錯誤:

C:\Users\Admin>npm install npm@latest -g
npm WARN npm npm does not support Node.js v12.18.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of 
Node.js.
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 
5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
npm[7656]: c:\ws\src\node_zlib.cc:575: Assertion `args.Length() == 7 && "init(windowBits, level, 
memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.

同樣由於某種原因, npm -v仍然顯示 5.5.1。 而且我不認為 Node 12.8.1 附帶 NPM 5.5.1。 那么也許我所做的那個覆蓋升級仍然存在?

任何幫助是極大的贊賞。

如果你已經安裝了 npm 然后卸載它並安裝 nvm。 使用 nvm 您可以安裝任何版本的節點,也可以安裝多個版本的節點。 您可以根據需要切換任何版本的節點。

這是安裝 nvm 的參考鏈接。 https://codeburst.io/nvm-for-windows-how-to-install-and-use-13b7a4209791

升級 npm 嘗試使用 sudo:

sudo npm install -g npm@latest

用 npm 升級 nodejs 試試這個:

sudo npm install -g n 

sudo n latest

這個問題是重復

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM