npm安装错误ubuntu

时间:2017-01-30 08:26:56

标签: node.js npm npm-install

您好我想安装一个名为nasim-bot的npm软件包,但是我收到了一个错误,无法找到解决方案。

命令是:

npm install nasim-bot

,错误是:

> unix-dgram@0.2.3 install /home/ali/Desktop/mailBot/node_modules/unix-dgram 
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:354:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-21-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/ali/Desktop/mailBot/node_modules/unix-dgram
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:unix-dgram@0.2.3 unix-dgram@0.2.3 install: `node-gyp rebuild`
npm WARN install:unix-dgram@0.2.3 Exit status 1
npm WARN mailbot@1.0.0 No repository field.

3 个答案:

答案 0 :(得分:1)

问题来自我安装的node.js.使用以下命令安装它:

sudo npm install -g n
sudo n latest

答案 1 :(得分:0)

运行命令后

sudo apt-get install aptitude

然后

sudo aptitude install npm

解决了我的问题

答案 2 :(得分:-1)

用这个命令检查你的 npm

<块引用>

sudo npm-check

如果出现错误则重新安装 npm。

如果 npm 没问题,那么肯定有一些依赖项会丢失或过时,大部分是过时的会导致问题。

<块引用>

npm install -g npm-check-updates

<块引用>

ncu -u

<块引用>

npm 更新

`