在使用node和npm创建命令行应用程序时,我遇到了很多摩擦。我以前做过简单的项目,但现在搞乱npm link
这样的命令似乎让我陷入困境。
例如,现在尝试安装软件包时:
alexanderbollbachs-MacBook-Pro:pmcli alexanderbollbach$ npm install cli-table --save
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alexanderbollbach/.npm/_logs/2017-07-11T22_39_32_076Z-debug.log
正在运行npm link
:
Unhandled rejection RangeError: Maximum call stack size exceeded0.0~preinstall: no script for preinstall, c
at exports.create (/usr/local/lib/node_modules/npm/lib/install/node.js:33:25)
at /usr/local/lib/node_modules/npm/lib/install/node.js:36:14
at Array.forEach (native)
at exports.create (/usr/local/lib/node_modules/npm/lib/install/node.js:33:25)
at /usr/local/lib/node_modules/npm/lib/install/node.js:36:14
at Array.forEach (native)
at exports.create (/usr/local/lib/node_modules/npm/lib/install/node.js:33:25)
at normalizeTree (/usr/local/lib/node_modules/npm/lib/install.js:377:5)
at Array.forEach (native)
at normalizeTree (/usr/local/lib/node_modules/npm/lib/install.js:379:19)
at Array.forEach (native)
at normalizeTree (/usr/local/lib/node_modules/npm/lib/install.js:379:19)
at Array.forEach (native)
at normalizeTree (/usr/local/lib/node_modules/npm/lib/install.js:379:19)
at Array.forEach (native)
at normalizeTree (/usr/local/lib/node_modules/npm/lib/install.js:379:19)
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alexanderbollbach/.npm/_logs/2017-07-11T22_42_51_880Z-debug.log
我很欣赏任何有关问题的见解。我已经读过用Homebrew
安装可能会导致问题。也许节点&lt; - &gt; npm配置不匹配。我在~/.npm-packages/bin
和.../lib/node-mules/
目录中搞得一团糟,所以我可能不小心删除了一些必要的文件(尽管这些文件应该在link
的后续调用中重新生成)。我也不完全确定究竟是什么链接,所以对这个过程的任何澄清都会受到极大的欢迎。