js-bson:无法加载c ++ bson扩展,使用纯JS版本

我试图在arch linux mini电脑(cubox)上安装mean.io。 所以我安装nodejs和mongodb软件包。

我用Git检索堆栈,做了一个npm安装(可以),但是:

input“grunt”后出现此错误:

[nodemon] v1.2.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching: *.* [nodemon] starting `node --debug server.js` debugger listening on port 5858 { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version fs.js:439 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: ENOENT, no such file or directory '/projects/mean/bower_components/jquery/dist/jquery.min.map' at Object.fs.openSync (fs.js:439:18) at Object.fs.readFileSync (fs.js:290:15) at module.exports (/projects/mean/node_modules/meanio/lib/bootstrap.js:31:27) at /projects/mean/node_modules/meanio/lib/mean.js:20:27 at Config.onPackageRead (/projects/mean/node_modules/meanio/lib/config.js:101:25) at Promise.<anonymous> (/projects/mean/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8) at Promise.emit (events.js:95:17) at Promise.emit (/projects/mean/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38) at Promise.fulfill (/projects/mean/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20) at Object.cb (/projects/mean/node_modules/mongoose/lib/query.js:1146:30) [nodemon] app crashed - waiting for file changes before starting... 

节点版本:v0.10.35 npm版本:2.1.18 MongoDB shell版本:2.6.6

我现在能做什么?? 任何想法??

附加信息:在npm安装期间我有一个警告:

 npm WARN cannot run in wd bson@0.2.16 (node-gyp rebuild 2> builderror.log) || (exit 0) (wd=/projects/mean/node_modules/bson) 

这里是builderror.log:

 cat builderror.log gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:38:25) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:41:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:52:16 gyp ERR! stack at Object.oncomplete (fs.js:108:15) gyp ERR! System Linux 3.14.27-1-ARCH gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /projects/mean/node_modules/bson gyp ERR! node -v v0.10.35 gyp ERR! node-gyp -v v1.0.2 gyp ERR! not ok 

我没有安装python(pacman -S python)。 python -V – > Python 3.4.2

###### 更多信息:

花了很多时间在这之后,我find了一些东西。 看起来“凉亭安装”不能作为根启动。 当我启动“npm install”时,它会调用“bower install”并失败。

我尝试启动'npm install –allow-root',但它也不起作用。

所以我想在archlinux中创build一个新的用户,但我不知道我应该添加哪个组。 (我创build了一个,有一些随机组,但是npm因为权限错误而失败)。

如果有人可以给我一个命令,以创build一个良好的用户组,所以我可以testing,如果解决了这个问题,这将是完美的。

以下是我在启动属于组“用户”的新用户的npm install时得到的错误:

 Error: EACCES, open '.bower-registry/bower.herokuapp.com/lookup/angular_d18b8' Installing module: mean-admin: rm: could not remove file (code EACCES): packages/contrib/mean-admin/.bowerrc 

更多信息:

我从头开始重新安装,而不是根。 在轮组中创build一个用户。 现在我被困在npm安装在这里:

 [tyvain@alarm fast-annonces]$ npm install npm WARN package.json express@4.10.6 No README data npm WARN package.json gridfs-stream@0.5.3 No README data npm WARN package.json supertest@0.11.0 No README data \ > mean@0.4.2 postinstall /projects/fast-annonces > node node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall module.js:340 throw err; ^ Error: Cannot find module '/projects/fast-annonces/node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:929:3 npm ERR! Linux 3.14.27-1-ARCH npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" npm ERR! node v0.10.35 npm ERR! npm v2.1.18 npm ERR! code ELIFECYCLE npm ERR! mean@0.4.2 postinstall: `node node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall` npm ERR! Exit status 8 npm ERR! npm ERR! Failed at the mean@0.4.2 postinstall script 'node node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall'. npm ERR! This is most likely a problem with the mean package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall npm ERR! You can get their info via: npm ERR! npm owner ls mean npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /projects/fast-annonces/npm-debug.log 

这是一场噩梦! 🙂

我想你在安装mongodb库时没有make工具。 我build议你这样做
苹果电脑:

 xcode-select --install 

Ubuntu的:

 sudo apt-get install gcc make build-essential 

并运行

 rm -rf node_modules npm cache clean npm install 

你需要python 2才能编译。 如果你的Python的path是python 3,那么这样做:

 npm config -g set python "/usr/bin/python2" 

“EACCES”错误意味着程序没有足够的权限来执行正在尝试的操作。

从我在这里读到的关于小组,你需要将用户添加到组wheel 。 使用这个命令:

 gpasswd -a [user] [group] 

请按照链接详细了解组和用户。

不幸的是,所有上述的答案只是一半的权利..花了很长时间来弄清楚这一点..

mongoose安装通过npm抛出警告,并导致错误…

 npm install -g node-gyp git clone https://github.com/mongodb/js-bson.git cd js-bson npm install node-gyp rebuild 

这工作像魔术!

在Ubuntu 14.04上,我需要在/ usr / bin中创build一个链接,因为/ usr / bin / env正在寻找/ usr / bin / node

ln -s / usr / bin / nodejs / usr / bin / node

错误消息可以在每个目录的builderror.log中find,以便消息:

bson@0.2.21 install / usr / local / lib / node_modules / mongodb / node_modules / mongodb-core / node_modules / bson(node-gyp rebuild 2> builderror.log) (出口0)查看此文件以获取有关确切问题的更多信息

/usr/local/lib/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/builderror.log

我用这个命令解决了这个问题

apt-get install nodejs-legacy