Cordova create error creating project (Error: Unhandled "error" event)

created at 07-06-2021 views: 7


Set up the cordova environment, the result

error message:

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.

The node version at that time was:

>node -v

The version of cordova is:

>cordova -version

After that I reduced the cordova version to 7.0

cnpm i cordova@7.0

However... the problem remains..


I don’t want to give up, continue to reduce the cordova version, this time down to 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)
    → 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)
    → 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)
    → 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

Create project again

> cordova create app
creating a new cordova project
created at:07-06-2021
edited at: 07-06-2021: