Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spm 2.1.11 在 Ubuntu 上安装失败 #83

Closed
edokeh opened this issue Aug 23, 2013 · 22 comments
Closed

spm 2.1.11 在 Ubuntu 上安装失败 #83

edokeh opened this issue Aug 23, 2013 · 22 comments

Comments

@edokeh
Copy link

edokeh commented Aug 23, 2013

Ubuntu 版本 12.04.1 32 位版本
但是尝试 2.1.10 发现是 OK 的
安装报错如下

> spm@2.1.11 preinstall /usr/lib/node_modules/spm
> node scripts/preinstall.js


NO SUDO PLEASE!!!
Maybe you need run:

$ sudo chown -R $USER /usr/local

More information on http://howtonode.org/introduction-to-npm
npm ERR! spm@2.1.11 preinstall: `node scripts/preinstall.js`
npm ERR! `sh "-c" "node scripts/preinstall.js"` failed with 1
npm ERR! 
npm ERR! Failed at the spm@2.1.11 preinstall script.
npm ERR! This is most likely a problem with the spm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/preinstall.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls spm
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-29-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "spm@2.1.11" "-g"
npm ERR! cwd /home/chaos
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/chaos/npm-debug.log
npm ERR! not ok code 0
@lepture
Copy link
Contributor

lepture commented Aug 23, 2013

spm@2.1.11 preinstall /usr/lib/node_modules/spm

看来你是要把 /usr/lib/node_modules/ 改成不用 sudo 就可以安装的。

为什么不要用 sudo: http://howtonode.org/introduction-to-npm

@edokeh
Copy link
Author

edokeh commented Aug 23, 2013

看到了,可是...这个方案我感觉很糟糕啊
现在给 /usr/lib/node_modules 加了权限,但是安装还是不成功,应该是没有权限 ls 吧

npm ERR! Error: EACCES, symlink '../lib/node_modules/spm/bin/spm'
npm ERR!  { [Error: EACCES, symlink '../lib/node_modules/spm/bin/spm']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '../lib/node_modules/spm/bin/spm' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

我去再找找资料吧,感觉更好的方案应该是对 npm 做一些改变

@afc163
Copy link
Member

afc163 commented Aug 23, 2013

sudo chown -R $USER /usr/local

@edokeh
Copy link
Author

edokeh commented Aug 23, 2013

@afc163
我的 npm 模块在 /usr/lib/node_modules 下,我使用 apt-get 装的 node

@edokeh
Copy link
Author

edokeh commented Aug 23, 2013

看了几个模块 forever, pm2 等等,在 Ubuntu 下不用 sudo 都是没法安装的(一样卡在 ln 那边)
Spm 新版的这个限制感觉没啥必要啊,是不是考虑去掉?

@afc163
Copy link
Member

afc163 commented Aug 23, 2013

你的 node 目测是在 /usr/bin 下,那么相应的,你应该是要把整个 usr 目录的权限加上。然后再安装应该就好了。

sudo chown -R $USER /usr

相信我,sudo 带来的问题会更多。

@lepture
Copy link
Contributor

lepture commented Aug 23, 2013

我想应该有办法解决

@popomore
Copy link
Member

是不是把 spm check 中的系统检测提出来用 shell 写,感觉更靠谱一点。

@edokeh
Copy link
Author

edokeh commented Aug 23, 2013

@afc163
神啊,把整个 /usr 的 owner 给某个非 root 用户,这样真的好嘛……

@afc163
Copy link
Member

afc163 commented Aug 23, 2013

是你自己电脑的话,问题不大。:smile:

@afc163
Copy link
Member

afc163 commented Aug 23, 2013

不放心的话,就重装一下 node curl http://npmjs.org/install.sh | sh

确保安到 /usr/local 下。

@edokeh
Copy link
Author

edokeh commented Aug 23, 2013

@afc163
。。。。。。。。。。。。幸亏公司的生产机全是 CentOS,但是也不能这么玩人啊
这个反 sudo 的检查 具体 是出于什么目的?感觉 spm 里没啥特别的地方啊

@popomore
Copy link
Member

用 nvm 吧

https://github.com/creationix/nvm

@afc163
Copy link
Member

afc163 commented Aug 23, 2013

sudo 各种问题,心力憔悴,能不用就不用。自从发现了去 sudo 的解决方案,咨询量骤降啊。

@afc163
Copy link
Member

afc163 commented Aug 23, 2013

又发现个去 sudo 的神方案集合,也是@isaacs 搞的:https://gist.github.com/isaacs/579814

@edokeh
Copy link
Author

edokeh commented Oct 18, 2013

@afc163
gist 里面第一个最简单好用
但是第一次把重要的程序装在 home 下面还是觉得怪怪的

@titanew
Copy link

titanew commented Nov 3, 2013

最后的解决方案是什么。。

@edokeh
Copy link
Author

edokeh commented Nov 3, 2013

不是写了嘛,就是不要用 sudo 安装 node

@michael-yin
Copy link

sudo chown -R $USER /usr
这条命令会导致ubuntu的sudo命令无法使用。。。这样不好把。。。

@edokeh
Copy link
Author

edokeh commented Nov 3, 2013

。。。你们为什么不点进那个 gist 看一下
https://gist.github.com/isaacs/579814

@michael-yin
Copy link

因为我还没看到那个gist,就已经敲了那个命令,现在重新装node。建议在那个安装指南上写上对node安装的建议,因为ubuntu用户喜欢apt-get,谢谢。

@afc163
Copy link
Member

afc163 commented Nov 3, 2013

@michael-yin 你可以帮忙 pull-request 一下,我们不用 ubuntu 的,所以对这个问题没有经验。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants