gpt4 book ai didi

macos - 在 Mac OS X Lion 上安装 npm@1.1.1 时出错

转载 作者:太空宇宙 更新时间:2023-11-03 22:43:02 26 4
gpt4 key购买 nike

我正在尝试在 Mac OS X Lion 上使用 Express 框架。遇到这些问题:

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

Node 版本v0.6.1。

我在网上查了一下,大多数答案都是从 Node 0.4天开始的,他们都只是说升级。看起来我比之前的问题更了解最新情况......

最佳答案

当你这样做时:

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

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

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

一切都会好起来的。

关于macos - 在 Mac OS X Lion 上安装 npm@1.1.1 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9366664/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com