2017-07-29 102 views
0

我正在使用Cordova 7.0.1以及node v7.10.1npm 4.2.0ubuntu 16.04Cordova创建项目错误:错误:未捕获,未指定“错误”事件

但是,当我尝试启动一个新的项目,我得到了以下错误:

Error: Uncaught, unspecified "error" event. ( Error from Cordova Fetch: Error: npm: Command failed with exit code 254 Error output: 
npm ERR! not a package /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
npm ERR! addLocal Could not install /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
npm ERR! Linux 4.10.0-28-generic 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js" 
npm ERR! node v7.10.1 
npm ERR! npm v4.2.0 
npm ERR! path /tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json 
npm ERR! code ENOENT 
npm ERR! errno -2 
npm ERR! syscall open 

npm ERR! enoent ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
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!  /home/alfred/.npm/_logs/2017-07-29T09_01_02_256Z-debug.log) 

The failing screen shot

而且~/.npm/_logs/2017-07-29T09_01_02_256Z-debug.log文件:

0 info it worked if it ends with ok 
1 verbose cli [ '/usr/bin/nodejs', 
1 verbose cli '/usr/bin/npm', 
1 verbose cli 'install', 
1 verbose cli '/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js' ] 
2 info using [email protected] 
3 info using [email protected] 
4 silly loadCurrentTree Starting 
5 silly install loadCurrentTree 
6 silly install readLocalPackageData 
7 silly fetchPackageMetaData /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
8 silly fetchOtherPackageData /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
9 silly cache add args [ '/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js', 
9 silly cache add null ] 
10 verbose cache add spec /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
11 silly cache add parsed spec Result { 
11 silly cache add raw: '/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js', 
11 silly cache add scope: null, 
11 silly cache add escapedName: null, 
11 silly cache add name: null, 
11 silly cache add rawSpec: '/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js', 
11 silly cache add spec: '/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js', 
11 silly cache add type: 'local' } 
12 silly addLocalTarball shasum (computed) 68d804862643855bd46c9138146b64789601b1da 
13 verbose addTmpTarball /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js not in flight; adding 
14 verbose correctMkdir /home/alfred/.npm correctMkdir not in flight; initializing 
15 verbose addTmpTarball validating metadata from /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
16 verbose tar unpack /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
17 verbose tar unpacking to /tmp/npm-19210-c6225b45/unpack-1e28fcae 
18 silly gentlyRm /tmp/npm-19210-c6225b45/unpack-1e28fcae is being purged 
19 verbose gentlyRm don't care about contents; nuking /tmp/npm-19210-c6225b45/unpack-1e28fcae 
20 silly gunzTarPerm modes [ '755', '644' ] 
21 error not a package /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
22 error addLocal Could not install /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js 
23 silly fetchPackageMetaData Error: ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
23 silly fetchPackageMetaData error for /usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js { Error: ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
23 silly fetchPackageMetaData errno: -2, 
23 silly fetchPackageMetaData code: 'ENOENT', 
23 silly fetchPackageMetaData syscall: 'open', 
23 silly fetchPackageMetaData path: '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' } 
24 silly rollbackFailedOptional Starting 
25 silly rollbackFailedOptional Finishing 
26 silly runTopLevelLifecycles Finishing 
27 silly install printInstalled 
28 verbose stack Error: ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
29 verbose cwd /home/alfred/.cordova/node_modules 
30 error Linux 4.10.0-28-generic 
31 error argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "/usr/lib/node_modules/cordova/node_modules/[email protected]@cordova-app-hello-world/index.js" 
32 error node v7.10.1 
33 error npm v4.2.0 
34 error path /tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json 
35 error code ENOENT 
36 error errno -2 
37 error syscall open 
38 error enoent ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
39 error enoent ENOENT: no such file or directory, open '/tmp/npm-19210-c6225b45/unpack-1e28fcae/package.json' 
39 error enoent This is most likely not a problem with npm itself 
39 error enoent and is related to npm not being able to find a file. 
40 verbose exit [ -2, true ] 

回答

0

用于在科尔多瓦新项目,命令是

cordova create FolderName PackageName ProjectName 

比如我想创建一个名为项目“科尔多瓦测试”则命令为

cordova create cordova-test com.example cordova-test 

它会为你工作。

+0

不是这个问题,我打印的命令在另一台机器上工作,当我打印完整的命令时,我的问题仍然存在。 –

相关问题