简体   繁体   English

npm安装错误ubuntu

[英]npm install error ubuntu

Hi I wanted to install a npm package called nasim-bot but i got an error and couldn't find a solution for it.嗨,我想安装一个名为 nasim-bot 的 npm 包,但出现错误并且找不到解决方案。

The command was:命令是:

npm install nasim-bot

and the error is:错误是:

> 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.

The problem was from the node.js that i installed.问题来自我安装的 node.js。 install it with this commands:使用以下命令安装它:

sudo npm install -g n
sudo n latest

After running command运行命令后

sudo apt-get install aptitude

then然后

sudo aptitude install npm

solved my problem解决了我的问题

check your npm with this command使用此命令检查您的 npm

sudo npm-check须藤 npm-check

if an error then re-install npm.如果出现错误,则重新安装 npm。

if npm is fine, then there must be some dependencies that would be missing or outdated, mostly outdated cause issues with it.如果 npm 没问题,那么肯定有一些依赖项会丢失或过时,大多数过时会导致它出现问题。

npm install -g npm-check-updates npm install -g npm-check-updates

ncu -u ncu -u

npm update更新

` `

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM