2015-01-08 40 views
4

我試圖在arch linux mini計算機(cubox)上安裝mean.io堆棧。 因此,我安裝nodejs和mongodb軟件包。js-bson:無法加載C++ bson擴展,使用純JS版本

我檢索使用Git棧,做出了NPM安裝(這是確定),但是:

我得到這個錯誤鍵入 '咕嚕' 後:

[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外殼版本:2.6.6

我現在可以做什麼?任何想法??

Addtional信息:我有NPM期間警告安裝:

npm WARN cannot run in wd [email protected] (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 

我沒裝蟒蛇(吃豆子-S蟒蛇)。 蟒蛇-V - >的Python 3.4.2

######更多信息:

願意花很多時間之後,我找到的東西。看起來'bower install'不能以root身份啓動。 當我啓動'npm install'時,它會調用'bower install'並失敗。

我嘗試啓動'npm install --allow-root',但它也不起作用。

所以我想在archlinux中創建一個新的用戶,但我不知道我應該添加他的什麼組。 (我創建了一個,有一些隨機的組,但是npm因爲權限錯誤失敗)。

如果有人可以給我一個命令來創建一個好的組中的用戶,所以我可以測試是否解決了這個問題是完美的。

這裏是推出NPM安裝一個新的用戶屬於該組「用戶」時,我得到的錯誤:

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 
更多信息:

我從一開始就重新安裝所有而不根。在輪組中創建一個用戶。現在我卡在npm安裝過程中:

[[email protected] fast-annonces]$ npm install 
npm WARN package.json [email protected] No README data 
npm WARN package.json [email protected] No README data 
npm WARN package.json [email protected] No README data 
\ 
> [email protected] 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! [email protected] postinstall: `node node_modules/meanio/node_modules/mean-cli/bin/mean-postinstall` 
npm ERR! Exit status 8 
npm ERR! 
npm ERR! Failed at the [email protected] 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 

這是一場惡夢! :)

回答

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路徑是蟒蛇3,那麼這樣做:

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

的「EACCES`錯誤意味着這個程序沒有足夠的權限做的是努力。

從我讀到的有關組01​​的信息中,您需要將用戶添加到組wheel。使用此命令:

gpasswd -a [user] [group] 

請點擊鏈接以詳細瞭解組和用戶。

+0

我已經閱讀了你的答案,但我有arch linux不是Ubuntu的。 sudo不工作...並建立必要的不存在 – Tyvain

+0

Arch:'pacman -S kernel26-headers file base-devel abs' should do the trick。 – bluefog

+0

通過[makepkg](https://wiki.archlinux.org/index.php/makepkg)使用部分了解更多關於在安裝上構建軟件包的信息 – bluefog

0

我解決了這個問題,此命令

的apt-get安裝的NodeJS遺留

0

在Ubuntu 14.04我需要創建在/ usr/bin中的鏈接,因爲在/ usr/bin中/ ENV一直在尋找的/ usr/bin中/節點

LN -s在/ usr/bin中/的NodeJS在/ usr/bin中/節點

錯誤消息可以在builderror.log每個導演找到y所以對於該消息:

[email protected] 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更多信息

1

不幸的是,以上所有的答案都只有一半的權利..花了很長時間來算出這個..

貓鼬通過NPM BSON安裝拋出警告,導致錯誤...

npm install -g node-gyp 

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

這就像魔術! !

+0

你在哪個目錄下執行這些步驟? – nottinhill

+0

node-gyp全局安裝,而根應用程序文件夾和node_modules/mongoose/node_modules的node_modules中的js-bson –