我尝试在arch linux mini计算机(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...
节点版本: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 - &gt; Python 3.4.2
###### 更多信息:花了很多时间,我发现了一些东西。似乎'bower install'无法以root身份启动。 当我启动'npm install'时,它会调用'bower install'并失败。
我尝试启动'npm install --allow-root',但它也不起作用。
所以我想在archlinux中创建一个新用户,但我不知道我应该添加哪个组。 (我确实创建了一个,有一些随机组,但是npm因权限错误而失败)。
如果有人可以向我发送命令以在好组中创建用户,那么我可以测试是否能解决问题,这将是完美的。
以下是使用属于“用户”组的新用户启动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
这是一场噩梦!! :)
答案 0 :(得分:17)
我猜你在安装mongodb库时没有make工具。我建议你做 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]
按照链接详细了解群组和用户。
答案 1 :(得分:1)
不幸的是,以上所有答案只有一半是正确的......花了很长时间来弄明白这一点..
通过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
这就像魔术一样!!
答案 2 :(得分:0)
我用这个命令解决了这个问题
apt-get install nodejs-legacy
答案 3 :(得分:0)
在ubuntu 14.04上我需要在/ usr / bin中创建一个链接,因为/ usr / bin / env正在寻找/ usr / bin / node
ln -s / usr / bin / nodejs / usr / bin / node
可以在每个目录的builderror.log中找到错误消息,以便显示消息:
bson@0.2.21 install / usr / local / lib / node_modules / mongodb / node_modules / mongodb-core / node_modules / bson(node-gyp rebuild 2&gt; builderror.log)|| (退出0) 查看此文件以获取有关确切问题的更多信息
/usr/local/lib/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/builderror.log