我正在尝试将 CLI 功能添加到我的 npm 包拦截代理中。我找不到任何好的文档,所以我基本上从express.js 复制和修改了内容。
I added:
"bin": {
"intercept-proxy": "./bin/intercept-proxy"
}
...我的 package.json 文件并创建了一个包含 CLI 内容的 /bin/intercept-proxy.js 。
当我跑步时:
npm install -g intercept-proxy
...一切正常,直到链接部分。然后它失败了,说:
npm ERR! Error: ENOENT, chmod 'C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy
...日志显示:
381 info linkStuff [email protected] /cdn-cgi/l/email-protection
382 verbose linkBins [email protected] /cdn-cgi/l/email-protection
383 verbose link bins [ { 'intercept-proxy': './bin/intercept-proxy' },
383 verbose link bins 'C:\\Users\\johan.obrink.24HRCOM\\AppData\\Roaming\\npm',
383 verbose link bins true ]
384 verbose linkMans [email protected] /cdn-cgi/l/email-protection
385 verbose rebuildBundles [email protected] /cdn-cgi/l/email-protection
386 verbose rebuildBundles [ 'commander', 'mkdirp', 'underscore' ]
387 info C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy unbuild
388 verbose from cache C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\package.json
389 info preuninstall [email protected] /cdn-cgi/l/email-protection
390 info uninstall [email protected] /cdn-cgi/l/email-protection
391 verbose true,C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules,C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules unbuild [email protected] /cdn-cgi/l/email-protection
392 verbose C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm,[object Object] binRoot
393 info postuninstall [email protected] /cdn-cgi/l/email-protection
394 error Error: ENOENT, chmod 'C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy'
395 error If you need help, you may report this log at:
395 error <http://github.com/isaacs/npm/issues>
395 error or email it to:
395 error <[email protected] /cdn-cgi/l/email-protection>
396 error System Windows_NT 6.1.7601
397 error command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "intercept-proxy"
398 error cwd c:\src
399 error node -v v0.8.9
400 error npm -v 1.1.61
401 error path C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy
402 error code ENOENT
403 error errno 34
404 verbose exit [ 34, true ]
我尝试用谷歌搜索 ENOENT、chown + Windows,但似乎没有进一步的结果。
完整代码位于https://github.com/JohanObrink/intercept-proxy https://github.com/JohanObrink/intercept-proxy
编辑:我现在在 OS X 上尝试过,问题是一样的。与Windows无关——显然只是与me-being-a-n00b相关。但仍然找不到问题所在。