macos - Mac npm 出现 ENOENT 错误

标签 macos node.js npm gruntjs

我最近刚从 Windows 转换到 Mac,目前正试图设置我的工具。

我首先使用自制软件安装了 Node ,这给我带来了错误(与我仍然有的一样)。后来我使用自制软件删除了 Node ,并使用 Node 网站上的 pkg 安装。

我可以在命令行和 npm 中访问 Node 。问题是当我尝试在本地项目上安装模块时,我得到如下信息:

npm 安装 grunt-contrib

Error extracting archive { [Error: ENOENT, open '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip']
  errno: 34,
  code: 'ENOENT',
  path: '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip' }

上面的另一条消息包含:

npm ERR! phantomjs@0.2.6 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 8
npm ERR!
npm ERR! Failed at the phantomjs@0.2.6 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.2.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-contrib"
npm ERR! cwd /Users/davidmckeown/dev/adt-com
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE

如果能帮助找出导致问题的原因,那将是非常棒的。据我所知,其他模块也会发生这种情况。

最佳答案

npm 缓存清理

或者如果安装在 su 下

sudo npm 缓存清理

关于macos - Mac npm 出现 ENOENT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15482658/

相关文章:

c# - 如何在 macOS 上的 Sublime Text 3 上运行 C#?

ios - 如何使用 Foundation 框架在 Swift 中创建和运行线程?

node.js - Grunt 无法启动 : ">> ReferenceError: grunt is not defined"

mysql - 如何从 mysql 格式化日期(我使用的是 node.js)?

javascript - 如何从本地文件夹安装 npm 模块?

javascript - 找不到模块 : Can't resolve '@emotion/react' in 'E:\frontend\node_modules\@mui\styled-engine'

macos - CGWindowListCopyWindowInfo、kCGWindowLayer 和窗口级别

c# - 没有等同于 CommonCrypto 的 CRC64 实现?

node.js - 如何替换 Node JS 事件接收器的 `this`?

Angular 2 路由在部署到 Http 服务器时不起作用