简体   繁体   English

尝试Cordova运行Android时出现错误消息

[英]Error message when trying to cordova run android

I am using Cordova 4.3.0 (latest version), I got an error while running this command, 我正在使用Cordova 4.3.0(最新版本),运行此命令时出现错误,

cordova run android

I got an error like this, 我遇到这样的错误,

module.js:340
    throw err;
          ^
Error: Cannot find module 'which'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/rajad/projects/dkit-cordova/platforms/android/cordova/lib/check_reqs.js:27:13)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Already I installed 'which' module on my machine, 我已经在机器上安装了“哪个”模块,

sudo npm install -g which

Even though, it's throwing module error. 即使这样,也会引发模块错误。

There might be a missing folder - which in: yourapp/platforms/android/cordova/node_modules 可能缺少文件夹- 文件夹位于: yourapp/platforms/android/cordova/node_modules

So, you can install it after navigating to that location. 因此,您可以在导航到该位置后进行安装。

cd platforms/android/cordova
sudo npm install which

Let me know if it won't work. 让我知道它是否行不通。 There could be a possibility that your Node is broken. 您的节点可能会损坏。 In that case you'd have to re-install Node and then add android platform again. 在这种情况下,您必须重新安装Node,然后再次添加android平台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM