gpt4 book ai didi

node.js - js-bson : Failed to load c++ bson extension, 使用纯JS版本

转载 作者:可可西里 更新时间:2023-11-01 09:06:50 26 4
gpt4 key购买 nike

我尝试在 arch linux 迷你计算机(cubox)上安装 mean.io 堆栈。所以我安装了 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...

Node 版本:v0.10.35npm 版本:2.1.18MongoDB 外壳版本: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

###### 更多信息:

在这上面花了很多时间之后,我发现了一些东西。似乎无法以 root 身份启动“bower install”。当我启动“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 库时没有可用的 make 工具。我建议你这样做
麦克:

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]

点击链接详细了解码和用户。

关于node.js - js-bson : Failed to load c++ bson extension, 使用纯JS版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27838122/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com