npm開發者文檔通過運行npm install -g .
來說make sure your package installs globally before publishing。我試圖構建一個可以全局安裝並運行的ES6 CLI包,但在運行Babel進行傳輸(使用es2015
插件)後,我的機器上的全局安裝失敗。npm install -g。不復制,失敗
I've created a simple demo ES6 project that reproduces the error。克隆和運行npm install -g .
在自述文件中引發錯誤:
$ npm install -g .
> [email protected] prepublish /Users/me/dev/es6-test
> npm run build
> [email protected] 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 [email protected]
3 info using [email protected]
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 ]
去根(項目),然後使用sudo調用它,還要設置您的NPM-文件的debug.log路徑, 給予許可。 – Monty
'sudo'似乎沒有區別。我應該在哪些文件上設置什麼權限?我附加了npm日誌文件輸出。 – orlade