node.js - NPM安装不安装所有组件,node gyp失败

  显示原文与译文双语对照的内容
0 0

我使用的是 ubuntu,我认为它是一个机

试图运行nodejs实例时,出现错误

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version

请按 link链接回答与上述问题相关。 问题是它没有装载。 没有安装。 是我的package.json 依赖项:


"dependencies": {
"express":"*",
"socket.io":"*",
"mongodb":"*",
"mongoose":"*"
}

运行安装 ( npm在最新版本中) 时,会得到以下信息:


npm WARN package.json forum@0.0.1 No description
npm WARN package.json forum@0.0.1 No repository field.
npm WARN package.json forum@0.0.1 No README data
npm WARN engine express@4.12.3: wanted: {"node":">= 0.10.0"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})
npm WARN engine mongoose@4.0.1: wanted: {"node":">=0.6.19"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})
(...)
npm WARN engine options@0.0.6: wanted: {"node":">=0.4.0"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})
-
> ws@0.5.0 install/usr/share/nginx/www/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

npm WARN engine hooks-fixed@1.0.1: wanted: {"node":">=0.4.0"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})
(...)
npm WARN engine base64-arraybuffer@0.1.2: wanted: {"node":">= 0.6.0"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})

> kerberos@0.0.10 install/usr/share/nginx/www/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

npm WARN engine bson-ext@0.1.0: wanted: {"node":">=0.8.19"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})
(...)
npm WARN engine tinycolor@0.0.1: wanted: {"node":">=0.4.0"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})

> ws@0.4.31 install/usr/share/nginx/www/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

npm WARN engine bson@0.2.21: wanted: {"node":">=0.6.19"} (current: {"node":"0.13.0-pre","npm":"2.7.5"})

> bson-ext@0.1.0 install/usr/share/nginx/www/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext
> (node-gyp rebuild 2> builderror.log) || (exit 0)


> kerberos@0.0.10 install/usr/share/nginx/www/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)


> bson@0.2.21 install/usr/share/nginx/www/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)


> bson@0.3.1 install/usr/share/nginx/www/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

实际上,这些文件夹中没有(,kerberos,ws ) 在node_modules子文件夹中找到。 所以它真的是英镑的。

我尝试运行的npm更新,不执行任何操作,总是重复相同的输出。 我尝试了节点gyp重建,下面是输出:


gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.3
gyp info using node@0.13.0-pre | linux | ia32
gyp ERR! configure error 
gyp ERR! stack Error:"pre" versions of node cannot be installed, use the --nodedir flag instead
gyp ERR! stack at install (/usr/local/lib/node_modules/node-gyp/lib/install.js:66:16)
gyp ERR! stack at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! stack at getNodeDir (/usr/local/lib/node_modules/node-gyp/lib/configure.js:152:20)
gyp ERR! stack at/usr/local/lib/node_modules/node-gyp/lib/configure.js:95:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:723:7)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at maybeClose (child_process.js:1000:16)
gyp ERR! stack at Socket.<anonymous> (child_process.js:1168:11)
gyp ERR! stack at Socket.emit (events.js:107:17)
gyp ERR! stack at Pipe.close (net.js:461:12)
gyp ERR! System Linux 3.13.0-48-generic
gyp ERR! command"node""/usr/local/bin/node-gyp""rebuild"
gyp ERR! cwd/usr/share/nginx/www
gyp ERR! node -v v0.13.0-pre
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 

我尝试用-g安装节点 gyp,没有什么工作。 这是到了我超越绝望的那一点。 谁能帮我? 非常感谢你。

时间: 原作者:

0 0

在相关性中,删除 mongodb 。mongoose将在它的内部安装驱动程序。


"dependencies": {
"express":"*",
"socket.io":"*", 
"mongoose":"*"
}

然后做


sudo npm unistall mongodb
sudo npm cache clean
sudo npm install

如果问题仍然存在,那么


sudo apt-get install build-essential

此外,如果你不是 root 用户,则始终运行sudo下的命令。

...