在Mac OS X Lion上安装npm@1.1.1时出错 [英] error installing npm@1.1.1 on Mac OS X Lion

查看:100
本文介绍了在Mac OS X Lion上安装npm@1.1.1时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mac OS X Lion上使用Express框架.存在以下问题:

I am trying to get going with express framework on Mac OS X Lion. Having these issues:

SilverFir-2:Node mike$ sudo curl http://npmjs.org/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7881  100  7881    0     0  29556      0 --:--:-- --:--:-- --:--:-- 43541
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@1.1
fetching: http://registry.npmjs.org/npm/-/npm-1.1.1.tgz
0.6.1
1.1.1
cleanup prefix=/usr/local

All clean!
npm ERR! Could not create /usr/local/lib/node_modules/___npm.npm
npm ERR! error installing npm@1.1.1

npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules'
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! 
npm ERR! System Darwin 11.3.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/6x/frvx23td327frc2z_hgl12sc0000gn/T/npm.3230/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/6x/frvx23td327frc2z_hgl12sc0000gn/T/npm.3230/package
npm ERR! node -v v0.6.1
npm ERR! npm -v 1.1.1
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules'
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/6x/frvx23td327frc2z_hgl12sc0000gn/T/npm.3230/package/npm-debug.log
npm not ok
It failed

节点版本v0.6.1.

Node version v0.6.1.

我在网上四处张望,大部分答案都来自节点0.4天,他们都说升级.看来我比以前的问题要新...

I looked around on the web and most of the answers are from node 0.4 days and they all just say upgrade. It looks like I am more up to date than those previous questions...

推荐答案

执行此操作时:

sudo curl http://npmjs.org/install.sh | sh

您将以root身份运行curl,但以当前用户身份运行sh.您应该改为这样做:

You will run curl as root, but sh as your current user. You should do this instead:

curl http://npmjs.org/install.sh | sudo sh

一切都会好起来的.

这篇关于在Mac OS X Lion上安装npm@1.1.1时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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