Node.js npm安装时间失败,出现make not found错误

Node.js npm安装时间失败,出现make not found错误,node.js,Node.js,当我尝试在nodejs服务器上安装time时,出现以下错误: time@0.8.4 install /var/www/track/node_modules/time node-gyp rebuild gyp ERR! build error gyp ERR! stack Error: not found: make gyp ERR! stack at F (/usr/lib/nodejs/npm/node_modules/which/which.js:43:28) gyp ERR! st

当我尝试在nodejs服务器上安装time时,出现以下错误:

time@0.8.4 install /var/www/track/node_modules/time
node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at F (/usr/lib/nodejs/npm/node_modules/which/which.js:43:28)
gyp ERR! stack     at E (/usr/lib/nodejs/npm/node_modules/which/which.js:46:29)
gyp ERR! stack     at /usr/lib/nodejs/npm/node_modules/which/which.js:57:16
gyp ERR! stack     at Object.oncomplete (fs.js:297:15)
gyp ERR! System Linux 3.2.0-31-virtual
gyp ERR! command "node" "/usr/lib/nodejs/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/track/node_modules/time
gyp ERR! node -v v0.8.15
gyp ERR! node-gyp -v v0.7.1
gyp ERR! not ok
npm ERR! time@0.8.4 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the time@0.8.4 install script.
npm ERR! This is most likely a problem with the time package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls time
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-31-virtual
npm ERR! command "nodejs" "/usr/bin/npm" "install" "time"
npm ERR! cwd /var/www/track
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/track/npm-debug.log
npm ERR! not ok code 0

你正在使用哪个操作系统

如果是Ubuntu,则需要安装build essential软件包:

$ sudo apt-get install build-essential

然后再次尝试安装该软件包。

我在CENTOS 7和RHEL 7基本映像上使用Docker时遇到同样的问题。。。请执行以下操作:

RUN yum install -y make gcc*

对我来说真是太好了

如果您使用的是Windows和npm,请通过cmd(管理员)安装:


npm安装--全局--生产windows构建工具

简单解决方案:

sudo apt-get install build-essential

然后重试

对于Manjaro/Arch Linux,您需要安装make和gcc

sudo pacman -S make gcc

请更新此帖子以显示您正在使用的操作系统。当前的答案对Ubuntu有效,但是,如果你澄清你的操作系统类型,对其他人会有帮助。在Angular 7项目上进行npm安装时也会遇到同样的问题。我在MAC OS上也面临同样的问题。你能指导我如何为MAC设置它吗。@学习者我相信你可能需要安装。它应该包含在OS X上编译本机模块所需的所有工具,类似于Ubuntu上的build essential。这解决了这个问题,因为程序“make”丢失,build essential软件包将它与其他一些编译工具(如g++)一起安装,如果你想这样做的话,需要这些工具来编译node。这应该被标记为答案,至少对于OP中没有提到的操作系统来说是这样。我还必须在
build-essential
之后安装mose东西,之后我就遵循了这个问题,最终让它在Ubuntu 17.04上安装这个解决了我的问题。谢谢朱利安!我想你帮我省了不少时间。谢谢我尝试不使用gcc*,但它不起作用。CENTOS 7非常感谢,在这篇文章发表两年多之后。它救了我一天
yum list gcc*| wc-l
打印
69
,因此安装工作量很大。我建议让构建失败并找出缺少的命令/工具,然后可以运行
yum提供的
来获取包名,然后安装它。对我来说,我只需要安装
make gcc-c++
(分别解释
make
g++
命令)对Arch Linux用户有帮助。我是Manjaro用户,这对我来说很有用,谢谢。