cordova create 创建项目出错 (Error: Unhandled "error" event)

在家搭建cordova环境,结果。。。

cordova create创建项目一直报错

D:\appProject>cordova create app
Creating a new cordova project.

(node:7368) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unhandled "error" event. (  Error from Cordova Fetch: Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "..\AppData\Roaming\npm\node_modules\cordova\node_modules\_cordova-app-hello-world@3.12.0@cordova-app-hello-world\index.js" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-04-05T07_50_24_550Z-debug.log)
(node:7368) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

当时的node版本是:

clipboard.png

cordova的版本是:

clipboard.png

之后我将cordova版本降到7.0

cnpm i cordova@7.0

然而...问题依旧......................................................

clipboard.png

不愿放弃的我,继续降低cordova版本,这次降低到6.0

cnpm install -g cordova@6.0.0
Downloading cordova to C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova_tmp
Copying C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova_tmp\_cordova@6.0.0@cordova to C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova
Installing cordova's dependencies to C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova/node_modules
[1/6] ansi@^0.3.0 installed at node_modules\_ansi@0.3.1@ansi
[2/6] q@1.0.1 installed at node_modules\_q@1.0.1@q
[3/6] underscore@1.7.0 installed at node_modules\_underscore@1.7.0@underscore
[4/6] nopt@3.0.1 installed at node_modules\_nopt@3.0.1@nopt
[5/6] update-notifier@^0.5.0 installed at node_modules\_update-notifier@0.5.0@update-notifier
[6/6] cordova-lib@6.0.0 installed at node_modules\_cordova-lib@6.0.0@cordova-lib
deprecate cordova-lib@6.0.0 › npmconf@^2.1.x this package has been reintegrated into npm and is now out of date with respect to npm
deprecate cordova-lib@6.0.0 › request@2.47.0 › node-uuid@~1.4.0 Use uuid module instead
deprecate cordova-lib@6.0.0 › xcode@0.8.0 › node-uuid@1.3.3 Use uuid module instead
deprecate cordova-lib@6.0.0 › cordova-js@4.1.3 › browserify@10.1.3 › glob@4.5.3 › minimatch@^2.0.1 Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
Recently updated (since 2018-03-29): 5 packages (detail see file C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\.recently_updates.txt)
  2018-04-04
    → update-notifier@0.5.0 › latest-version@1.0.1 › package-json@1.2.0 › got@3.3.1 › read-all-stream@3.1.0 › readable-stream@^2.0.0(2.3.6) (23:40:14)
  2018-04-03
    → cordova-lib@6.0.0 › cordova-js@4.1.3 › browserify@10.1.3 › crypto-browserify@3.12.0 › browserify-cipher@1.0.0 › browserify-aes@^1.0.4(1.2.0) (22:23:16)
  2018-03-30
    → update-notifier@0.5.0 › latest-version@1.0.1 › package-json@1.2.0 › got@3.3.1 › read-all-stream@3.1.0 › readable-stream@2.3.6 › string_decoder@~1.1.1(1.1.1) (16:14:15)
    → cordova-lib@6.0.0 › init-package-json@1.10.3 › read-package-json@2.0.13 › json-parse-better-errors@^1.0.1(1.0.2) (23:08:03)
    → cordova-lib@6.0.0 › cordova-serve@1.0.1 › express@4.16.3 › body-parser@1.18.2 › http-errors@~1.6.2(1.6.3) (04:29:06)
All packages installed (340 packages installed from npm registry, used 24s, speed 811.13kB/s, json 304(2.17MB), tarball 17.12MB)
[cordova@6.0.0] link C:\Users\Administrator\AppData\Roaming\npm\cordova@ -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\bin\cordova

再次创建项目

cordova create app

clipboard.png

居然成功了!!!

clipboard.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值