js-bson:使用纯JS版本无法加载c ++ bson扩展 [英] js-bson: Failed to load c++ bson extension, using pure JS version

查看:103
本文介绍了js-bson:使用纯JS版本无法加载c ++ bson扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一台linux小型拱形计算机(cubox)上安装mean.io堆栈. 因此,我安装了nodejs和mongodb软件包.

I tried to install mean.io stack on an arch linux mini computer (the cubox). So I install nodejs and mongodb packages.

我使用Git检索堆栈,进行了npm安装(可以),但是然后:

I retrieve the stack with Git, made an npm install (it was ok) but then:

输入"grunt"后出现此错误:

I get this error after typing '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

node version: v0.10.35 npm version: 2.1.18 MongoDB shell version: 2.6.6

我现在该怎么办?有什么想法吗?

What can I do now?? Any Idea??

其他信息:在安装npm时出现警告:

Addtional info: I have a warn during npm install:

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:

Here is 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

I did installed python (pacman -S python). python -V -> Python 3.4.2

花了很多时间之后,我发现了一些东西.似乎"bower安装"不能以root用户身份启动. 当我启动"npm install"时,它称为"bower install",并且失败.

After spending many time on this, I find something. It seems that 'bower install' can't be launch as root. And when I launch 'npm install' it calls 'bower install' and fail.

我尝试启动'npm install --allow-root',但这也不起作用.

I try launching 'npm install --allow-root', but it doesn't work either.

所以我想在archlinux中创建一个新用户,但是我也不知道我应该添加哪个组. (我确实创建了一个,带有一些随机组,但是npm失败,出现权限错误.)

So I wanted to create a new user in archlinux, but I don't know what group I should add him too. (I did create one, with some random groups but npm failed with a permission error).

如果有人可以向我发送命令以在好的组中创建用户,那么我可以测试是否可以解决问题,这将是完美的.

If someone can send me a command to create a user in the good groups so I can test if that solve the problem it would be perfect.

这是我使用属于用户"组的新用户启动npm install时遇到的错误:

Here is the error I get when launching npm install with a new user belonging to the group 'users':

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就重新安装了所有软件.在滚轮组中创建一个用户.现在我在这里的npm安装过程中被卡住了:

More info:

I reinstall all from the start without being root. Create a user in wheel group. Now I am stuck during npm install here:

[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

这是一场噩梦!! :)

This is a nightmare!! :)

推荐答案

我猜您在安装mongodb库时没有可用的make工具.我建议你
Mac:

I guess you did not have the make tools available when you installed your mongodb library. I suggest you do
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,请执行以下操作:

You need python 2 for it to compile. If your path to python is for python 3 then do this :

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

"EACCES"错误表示该程序没有足够的权限执行尝试执行的操作.

The 'EACCES` error means the program did not have enough privileges to do what is trying to.

根据我在此处所了解的内容,您需要将用户添加到wheel组中.使用此命令:

From what I read about groups here, you need to add the user to the group wheel. Use this command :

gpasswd -a [user] [group]

点击链接以详细了解组和用户.

Follow the link for a detailed understanding of groups and users.

这篇关于js-bson:使用纯JS版本无法加载c ++ bson扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆