javascript - 在 Yosemite 上安装 Yeoman 时出错

标签 javascript node.js npm yeoman

我花了几天时间尝试在我的 OS X 中安装 Yeoman,但无法 =/

当我尝试安装时出现此错误:

Mac-Pro:~ pauloricardo$ sudo npm i -g yo
Password:

> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1b686b7a6c7536686275785b2a352b352a2a" rel="noreferrer noopener nofollow">[email protected]</a> postinstall /usr/local/lib/node_modules/yo/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall

sh: node: command not found
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "i" "-g" "yo"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="196a69786e77346a60777a59283729372828" rel="noreferrer noopener nofollow">[email protected]</a> postinstall: `node postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0d7e7d6c7a63207e74636e4d3c233d233c3c" rel="noreferrer noopener nofollow">[email protected]</a> postinstall script 'node postinstall'.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node postinstall
npm ERR! You can get their info via:
npm ERR!     npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/pauloricardo/npm-debug.log

我已经尝试以 root 用户身份安装并清理 npm 缓存。但我也得到了同样的结果。

如果有人想查看我的 npm 日志,请点击以下链接:http://pastebin.com/Arb6i58q

如果有任何帮助,我将非常感激

提前致谢。

最佳答案

尝试运行sudo npm install -g --unsafe-perm yo。这是某种权限问题。看看这个 github 线程,他们还提供了一些其他解决方案 https://github.com/ForbesLindesay/spawn-sync/issues/11 .

关于javascript - 在 Yosemite 上安装 Yeoman 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31121453/

相关文章:

node.js - npm 错误!解析 '..."jscs 附近时 JSON 输入意外结束“:"~3.0.7","moch'

javascript - 为什么用户选中一个框与以编程方式执行不同?

Javascript - 字符串搜索,什么可以解决它?

node.js - npm 警告 : npm does not support Node. js v12.4.0

javascript - 使用 github 版本更新 package.json 中的版本

javascript - 如何将node.js传递到html?

javascript - 如何检查脏标志

javascript - Babel 代码抛出超出最大调用堆栈大小

node.js - Puppeteer 页脚仅显示在最后一页

node.js - 通过企业代理地址将 Node.js 与 Salesforce 集成,并从 CSV 文件执行批量插入操作