js-bson: 无法加载 c++ bson 扩展,使用纯 JS 版本
js-bson: Failed to load c++ bson extension, using pure JS version
我试图在 arch linux 迷你计算机(cubox)上安装 mean.io stack。
所以我安装了 nodejs 和 mongodb 包。
我用 Git 检索了堆栈,进行了 npm 安装(没问题)但是然后:
输入 '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
###### 更多信息:
在这上面花了很多时间之后,我发现了一些东西。 'bower install' 似乎无法以 root 身份启动。
当我启动 'npm install' 时,它会调用 'bower install' 并失败。
我尝试启动 'npm install --allow-root',但它也不起作用。
所以我想在 archlinux 中创建一个新用户,但我也不知道应该将他添加到哪个组。
(我确实创建了一个,有一些随机组,但 npm 因权限错误而失败)。
如果有人可以向我发送命令以在 good 组中创建一个用户,以便我测试是否能解决问题,那就完美了。
这是我在使用属于 'users' 组的新用户启动 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
更多信息:
我从头开始重新安装,而不是 root。在 wheel 组中创建一个用户。现在我在 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 库时没有可用的制作工具。我建议你做
Mac:
xcode-select --install
Ubuntu:
sudo apt-get install gcc make build-essential
和运行
rm -rf node_modules
npm cache clean
npm install
您需要 python 2 才能编译。如果您通往 python 的路径是 python 3 则执行此操作:
npm config -g set python "/usr/bin/python2"
“EACCES”错误意味着程序没有足够的权限来执行正在尝试执行的操作。
根据我对群组 here 的了解,您需要将用户添加到群组 wheel
。使用此命令:
gpasswd -a [user] [group]
关注link,详细了解群组和用户。
我用这个命令解决了问题
apt-get install nodejs-legacy
on ubuntu 14.04 我需要在 /usr/bin 中创建一个 link 因为 /usr/bin/env 正在寻找 /usr/bin/node
ln -s /usr/bin/nodejs /usr/bin/node
可以在每个目录的 builderror.log 中找到错误消息,因此对于消息:
bson@0.2.21 安装 /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
不幸的是,以上所有答案只对了一半..花了很长时间才弄明白..
通过 npm 安装 Mongoose bson 抛出警告并导致错误...
npm install -g node-gyp
git clone https://github.com/mongodb/js-bson.git
cd js-bson
npm install
node-gyp rebuild
这就像魔法一样有效!!
我试图在 arch linux 迷你计算机(cubox)上安装 mean.io stack。 所以我安装了 nodejs 和 mongodb 包。
我用 Git 检索了堆栈,进行了 npm 安装(没问题)但是然后:
输入 '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
###### 更多信息:在这上面花了很多时间之后,我发现了一些东西。 'bower install' 似乎无法以 root 身份启动。 当我启动 'npm install' 时,它会调用 'bower install' 并失败。
我尝试启动 'npm install --allow-root',但它也不起作用。
所以我想在 archlinux 中创建一个新用户,但我也不知道应该将他添加到哪个组。 (我确实创建了一个,有一些随机组,但 npm 因权限错误而失败)。
如果有人可以向我发送命令以在 good 组中创建一个用户,以便我测试是否能解决问题,那就完美了。
这是我在使用属于 'users' 组的新用户启动 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
更多信息:
我从头开始重新安装,而不是 root。在 wheel 组中创建一个用户。现在我在 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 库时没有可用的制作工具。我建议你做
Mac:
xcode-select --install
Ubuntu:
sudo apt-get install gcc make build-essential
和运行
rm -rf node_modules
npm cache clean
npm install
您需要 python 2 才能编译。如果您通往 python 的路径是 python 3 则执行此操作:
npm config -g set python "/usr/bin/python2"
“EACCES”错误意味着程序没有足够的权限来执行正在尝试执行的操作。
根据我对群组 here 的了解,您需要将用户添加到群组 wheel
。使用此命令:
gpasswd -a [user] [group]
关注link,详细了解群组和用户。
我用这个命令解决了问题
apt-get install nodejs-legacy
on ubuntu 14.04 我需要在 /usr/bin 中创建一个 link 因为 /usr/bin/env 正在寻找 /usr/bin/node
ln -s /usr/bin/nodejs /usr/bin/node
可以在每个目录的 builderror.log 中找到错误消息,因此对于消息:
bson@0.2.21 安装 /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
不幸的是,以上所有答案只对了一半..花了很长时间才弄明白..
通过 npm 安装 Mongoose bson 抛出警告并导致错误...
npm install -g node-gyp
git clone https://github.com/mongodb/js-bson.git
cd js-bson
npm install
node-gyp rebuild
这就像魔法一样有效!!