无法让 npm install -g 为我的包工作 [英] Cannot make npm install -g work for my package

查看:40
本文介绍了无法让 npm install -g 为我的包工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 CLI 功能添加到我的 npm 包intercept-proxy.我找不到任何好的文档,所以我基本上从 express.js 中复制和修改了内容.

I am trying to add CLI functionality to my npm package intercept-proxy. I couldn't find any good documentation so I basically copied and modified stuff from express.js.

我补充说:

"bin": {
    "intercept-proxy": "./bin/intercept-proxy"
}

...到我的 package.json 文件并创建一个包含 CLI 内容的/bin/intercept-proxy.js.

...to my package.json file and created a /bin/intercept-proxy.js which contains the CLI stuff.

当我跑步时:

npm install -g intercept-proxy

...一切正常,直到链接部分.然后它失败了,说:

... everything works until the linking part. Then it fails, saying:

npm ERR! Error: ENOENT, chmod 'C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules\intercept-proxy\bin\intercept-proxy

...并且日志说:

381 info linkStuff intercept-proxy@0.2.4
382 verbose linkBins intercept-proxy@0.2.4
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 intercept-proxy@0.2.4
385 verbose rebuildBundles intercept-proxy@0.2.4
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 intercept-proxy@0.2.4
390 info uninstall intercept-proxy@0.2.4
391 verbose true,C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules,C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm\node_modules unbuild intercept-proxy@0.2.4
392 verbose C:\Users\johan.obrink.24HRCOM\AppData\Roaming\npm,[object Object] binRoot
393 info postuninstall intercept-proxy@0.2.4
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     <npm-@googlegroups.com>
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,但似乎没有进一步.

I tried googling ENOENT, chown + Windows but don't seem to get any further.

完整代码位于 https://github.com/JohanObrink/intercept-proxy

我现在已经在 OS X 上试过了,问题是一样的.与 Windows 无关 - 显然与 me-being-a-n00b 相关.仍然找不到问题所在.

I have now tried it on OS X and the problem is the same. Not windows related - just me-being-a-n00b related apparently. Still cannot find what's wrong though.

推荐答案

ENOENT 表示没有这样的文件或目录.如果你改成这个会怎样?

ENOENT means no such file or directory. What happens if you change to this?

"bin": {
    "intercept-proxy": "./bin/intercept-proxy.js"
}

这篇关于无法让 npm install -g 为我的包工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆