我想创建可以全局安装的 npm 包。我可以发布包,发布新版本,但是当我想全局安装它时,它不起作用。
yarn global add <package>
输出:
success Installed "pentest-tool-lite@0.0.3" with binaries:
- pentest-tool-lite
npm install -g <package>
输出:
npm ERR! path /nvm/versions/node/v8.7.0/lib/node_modules/pentest-tool-lite/lib/index
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'nvm/versions/node/v8.7.0/lib/node_modules/pentest-tool-lite/lib/index'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! _logs/2017-12-03T16_00_34_926Z-debug.log
调试日志:
7877 info linkStuff pentest-tool-lite@0.0.3
7878 silly linkStuff pentest-tool-lite@0.0.3 has /Users/juffalow/.nvm/versions/node/v8.7.0/lib/node_modules as its parent node_modules
7879 silly linkStuff pentest-tool-lite@0.0.3 is part of a global install
7880 silly linkStuff pentest-tool-lite@0.0.3 is installed into a global node_modules
7881 silly linkStuff pentest-tool-lite@0.0.3 is installed into the top-level global node_modules
7882 verbose linkBins pentest-tool-lite@0.0.3
7883 verbose linkBins [ { 'pentest-tool-lite': './lib/index' },
7883 verbose linkBins '/Users/juffalow/.nvm/versions/node/v8.7.0/bin',
7883 verbose linkBins true ]
7884 verbose linkMans pentest-tool-lite@0.0.3
7885 verbose unlock done using /Users/juffalow/.npm/_locks/staging-fa43d53d0ab27b11.lock for /Users/juffalow/.nvm/versions/node/v8.7.0/lib/node_modules/.staging
7886 verbose stack Error: ENOENT: no such file or directory, chmod '/Users/juffalow/.nvm/versions/node/v8.7.0/lib/node_modules/pentest-tool-lite/lib/index'
7887 verbose cwd /Users/juffalow/NetBeansProjects/pentest-tool-lite
7888 verbose Darwin 16.0.0
7889 verbose argv "/Users/juffalow/.nvm/versions/node/v8.7.0/bin/node" "/Users/juffalow/.nvm/versions/node/v8.7.0/bin/npm" "install" "-g" "pentest-tool-lite"
7890 verbose node v8.7.0
7891 verbose npm v5.4.2
7892 error path /Users/juffalow/.nvm/versions/node/v8.7.0/lib/node_modules/pentest-tool-lite/lib/index
7893 error code ENOENT
7894 error errno -2
7895 error syscall chmod
7896 error enoent ENOENT: no such file or directory, chmod '/Users/juffalow/.nvm/versions/node/v8.7.0/lib/node_modules/pentest-tool-lite/lib/index'
7897 error enoent This is related to npm not being able to find a file.
7898 verbose exit [ -2, true ]
Yarn 似乎安装成功,但不是。NPM显示错误但我真的不知道为什么?你对模块有什么经验吗?