gpt4 book ai didi

node.js - 使用 npm 在 Mac OS X 上安装 MEANIO 时出现问题

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

当我尝试使用 npm 在 Mac 上安装 MEANIO 时,遇到了几个错误,导致安装失败。错误如下所示:

问题主要有两种类型:一种是Error EACCES,另一种是ERROR ENOENT。我尝试了几种解决方案,但并没有多大帮助。

1. sudo npm clear cache 
2. sudo npm update -g
3. Permission fix: by changing nodejs folder's permission to local user

(引用:npm install errors with Error: ENOENT, chmod)

我想知道是什么原因导致了这个问题。由于我没有发布自己的应用程序,因此无法根据链接中提供的解决方案包含 .npmignore。链接中的第二个答案声称问题的本质是:

"Above action caused some dependencies being installed inside ~/.npm/ dir, having root:root ownership (because of sudo ...). Evidently npm does not run as local user (or change dependencies subdirs ownership afterwards) when pulling dependencies and writing them to a local user subdir ~/.npm/. As long as npm would be so careless against fundamental unix filesystem security issues the problem would reoccur."

我怀疑这对我来说是否正确。 MEANIO 的安装不应该引起这么多问题。

shell 命令和错误消息如下所示:

localhost:local Nick_Guan$ sudo npm install -g meanio@latest
npm WARN engine meanio@0.6.6: wanted: {"node":"0.10.x","npm":"1.4.x"} (current: {"node":"0.10.31","npm":"2.0.0-beta.1"})
npm WARN engine npm@1.5.0-alpha-4: wanted: {"node":">=0.8","npm":"1"} (current: {"node":"0.10.31","npm":"2.0.0-beta.1"})

> mean-health@0.1.5 postinstall /usr/local/lib/node_modules/meanio/node_modules/mean-health
> node postinstall

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

node.js:815
var cwd = process.cwd();
^
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:815:23)
at startup (node.js:58:13)
at node.js:906:3
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/meanio/node_modules/prompt/test/prompt-test.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "meanio@latest"
npm ERR! cwd /usr/local
npm ERR! node -v v0.10.31
npm ERR! npm -v 2.0.0-beta.1
npm ERR! path /usr/local/lib/node_modules/meanio/node_modules/prompt/test/prompt-test.js
npm ERR! fstream_path /usr/local/lib/node_modules/meanio/node_modules/prompt/test/prompt-test.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:308:19
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:143:7
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/meanio/node_modules/npm/bin/npm-cli.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "meanio@latest"
npm ERR! cwd /usr/local
npm ERR! node -v v0.10.31
npm ERR! npm -v 2.0.0-beta.1
npm ERR! path /usr/local/lib/node_modules/meanio/node_modules/npm/bin/npm-cli.js
npm ERR! fstream_path /usr/local/lib/node_modules/meanio/node_modules/npm/bin/npm-cli.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:308:19
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/meanio/node_modules/bower/lib/config.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "meanio@latest"

如有任何帮助,我们将不胜感激。

最佳答案

仔细检查先决条件是否安装正确,确保在主目录下的某个位置执行安装命令。

查看此处:https://groups.google.com/forum/#!topic/gnu.bash.bug/JkcxWDfilZI

You're in a directory which can be read and searched only by root, and you're su'ing to another user. That user does not have permission to search the current directory, even to find `..', so getcwd is going to fail.

关于node.js - 使用 npm 在 Mac OS X 上安装 MEANIO 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25566008/

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