运行任何cordova命令时出现错误:“ throw er; //未处理的'错误'事件”

时间:2019-04-05 10:29:01

标签: cordova ionic-framework ionic4

当在ionic(4.12)项目中运行任何“ ionic cordova”命令时,出现错误消息:

throw er; // Unhandled 'error' event

例如在运行时:

ionic cordova plugin add cordova-sqlite-storage

events.js:167
throw er; // Unhandled 'error' event

Error: spawn /development/myBarApp/node_modules/.bin/cordova ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
at onErrorNT (internal/child_process.js:421:16)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:252:12)
at onErrorNT (internal/child_process.js:421:16)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
[ERROR] An error occurred while running subprocess cordova.

cordova plugin add cordova-sqlite-storage --save exited with exit code 1.

Re-running this command with the --verbose flag may provide more information.

我确保我的xCode和ionic是最新的。 例如,运行时出现相同的错误

ionic cordova platform add ios

1 个答案:

答案 0 :(得分:0)

大约npm i -g cordova解决了该问题。