NPM 安装问题 ubuntu



我想安装 npm以将 angular2 与 laravel5.2 一起使用,但在安装 npm 时。我得到了以下问题:

npm WARN npm npm does not support Node.js v0.10.25
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 You can find the latest version at https://nodejs.org/
/usr/local/lib/node_modules/npm/lib/install.js:298
[this, (next) => { computeMetadata(this.idealTree); next() }],
^
npm ERR! Unexpected token >  
npm ERR! A complete log of this run can be found in:  
npm ERR!     /home/swapnily/.npm/_logs/2017-07-06T07_21_24_104Z-debug.log  

如果有人知道这一点,请告诉我。

尝试运行:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

仔细检查安装过程中没有错误。

然后通过键入exit重新启动 ssh 会话(以防万一),然后重新连接。

然后使用node -v检查您的安装。

如果仍然不起作用,则应检查哪个nodewhich node一起使用。问题可能出在这里(旧版本的节点安装在其他地方并正在使用中)。

npm 不支持 Node.js v0.10.25

您正在使用早已弃用的v0.10.25,因此会出现此错误。

您需要节点 v4 或更高版本才能运行此程序。

要安装适用于节点 v0.12 及更早版本的不受支持的旧 npm,请克隆 git 存储库并挖掘旧标签和分支。

来源 npm 的文档

我已经安装了" curl -sL deb.nodesource.com/setup_6.x

目前尚不清楚这是否成功。 假设这成功而没有错误。检查当前正在使用哪个版本的节点。

sridharrajs@debian:~$ which node  
/home/sridharrajs/.nvm/versions/node/v5.11.1/bin/node  -- In mycase I'm using version 5.11.1

切换到刚刚安装v6.x.x,然后重试安装。

如果您在安装和切换节点版本时仍然遇到问题,我建议您检查 nvm。使用它,您可以轻松安装和切换版本。

最新更新