繁体   English   中英

npm install -g。 不复制,失败

[英]npm install -g . doesn't copy, fails

npm开发人员文档说,通过运行npm install -g . 确保发布之前全局安装了您的软件包 npm install -g . 我正在尝试构建一个可以在全球安装和运行的ES6 CLI软件包,但是在运行Babel进行编译(使用es2015插件)后,我的计算机上的全局安装失败。

我创建了一个简单的演示ES6演示项目,该项目再现了错误 克隆并运行npm install -g . 在自述文件中引发错误:

$ npm install -g .

> es6-test@0.0.1 prepublish /Users/me/dev/es6-test
> npm run build


> es6-test@0.0.1 build /Users/me/dev/es6-test
> babel --out-dir es5/ src/

src/bin/app.js -> es5/bin/app.js
src/core/location.js -> es5/core/location.js
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.4.0/bin/node" "/usr/local/bin/npm" "install" "-g" "."
npm ERR! node v5.4.0
npm ERR! npm  v3.3.12
npm ERR! path /usr/local/lib/node_modules/es6-test/es5/bin/app
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/es6-test/es5/bin/app'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/me/dev/es6-test/npm-debug.log

难道我做错了什么? 我用Babel和NPM尝试了一些不同的命令,但最终似乎没有任何内容复制到/usr/local/lib/node_modules

$ node -v
v5.4.0

$ npm -v
3.3.12

编辑:错误似乎与最新节点和v0.10.24相同,带有和不带有sudo 日志文件说:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/5.4.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i',
1 verbose cli   '-g',
1 verbose cli   '.gs' ]
2 info using npm@3.3.12
3 info using node@v5.4.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData .gs
8 silly fetchOtherPackageData .gs
9 silly cache add args [ '.gs', null ]
10 verbose cache add spec .gs
11 silly cache add parsed spec Result {
11 silly cache add   raw: '.gs',
11 silly cache add   scope: null,
11 silly cache add   name: null,
11 silly cache add   rawSpec: '.gs',
11 silly cache add   spec: '/Users/me/dev/es6-test/.gs',
11 silly cache add   type: 'local' }
12 error addLocal Could not install /Users/me/dev/es6-test/.gs
13 silly fetchPackageMetaData Error: ENOENT: no such file or directory, open '/Users/me/dev/es6-test/.gs'
13 silly fetchPackageMetaData     at Error (native)
13 silly fetchPackageMetaData  error for .gs { [Error: ENOENT: no such file or directory, open '/Users/me/dev/es6-test/.gs']
13 silly fetchPackageMetaData   errno: -2,
13 silly fetchPackageMetaData   code: 'ENOENT',
13 silly fetchPackageMetaData   syscall: 'open',
13 silly fetchPackageMetaData   path: '/Users/me/dev/es6-test/.gs' }
14 silly rollbackFailedOptional Starting
15 silly rollbackFailedOptional Finishing
16 silly runTopLevelLifecycles Starting
17 silly runTopLevelLifecycles Finishing
18 silly install printInstalled
19 verbose stack Error: ENOENT: no such file or directory, open '/Users/me/dev/es6-test/.gs'
19 verbose stack     at Error (native)
20 verbose cwd /Users/me/dev/es6-test
21 error Darwin 14.5.0
22 error argv "/usr/local/Cellar/node/5.4.0/bin/node" "/usr/local/bin/npm" "i" "-g" ".gs"
23 error node v5.4.0
24 error npm  v3.3.12
25 error path /Users/me/dev/es6-test/.gs
26 error code ENOENT
27 error errno -2
28 error syscall open
29 error enoent ENOENT: no such file or directory, open '/Users/me/dev/es6-test/.gs'
29 error enoent This is most likely not a problem with npm itself
29 error enoent and is related to npm not being able to find a file.
30 verbose exit [ -2, true ]

package.json"bin"属性指向es5/binapp.js文件,但没有app.js文件。 您需要将其指向csp.js文件:

package.json

"bin": {
    "csp": "es5/bin/csp.js"
},

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM