更新 npm、cordova 后出错
Error after updating npm, cordova
我更新了 npm 和 cordova,之后我无法从终端运行 任何 cordova 命令。这是我得到的错误:
Avinash-mac-mini:~ avinash$ cordova
module.js:339
throw err;
Error: Cannot find module 'umask'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/npm/lib/utils/umask.js:1:75)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
我对 cordova build ios 命令有同样的问题。
根据科尔多瓦文档(https://cordova.apache.org/docs/en/latest/guide/cli/index.html):
After you run the npm command above to update Cordova itself, you may
need to ensure your project's resources conform to the latest
version's requirements. Run a command such as the following for each
platform you're building:
$ cordova platform update android
$ cordova platform update ios
...etc.
我已经通过在 cordova 更新后更新我的 ios 平台解决了这个问题:
$ cordova platform update ios
尝试执行
npm uninstall -g cordova
npm install -g cordova@latest
我更新了 npm 和 cordova,之后我无法从终端运行 任何 cordova 命令。这是我得到的错误:
Avinash-mac-mini:~ avinash$ cordova
module.js:339
throw err;
Error: Cannot find module 'umask'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/npm/lib/utils/umask.js:1:75)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
我对 cordova build ios 命令有同样的问题。 根据科尔多瓦文档(https://cordova.apache.org/docs/en/latest/guide/cli/index.html):
After you run the npm command above to update Cordova itself, you may need to ensure your project's resources conform to the latest version's requirements. Run a command such as the following for each platform you're building:
$ cordova platform update android $ cordova platform update ios ...etc.
我已经通过在 cordova 更新后更新我的 ios 平台解决了这个问题:
$ cordova platform update ios
尝试执行
npm uninstall -g cordova
npm install -g cordova@latest