[英]Cannot find module 'which' - Cordova android
I am trying to build my cordova build by executing below command 我正在尝试通过执行以下命令来构建我的cordova构建
cordova -d build android
but I am necountering below error. 但我错误地发现了。
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)
anyone knows the reason? 谁知道原因? I checked that I have my ANT_HOME/ANDROID_HOME in my path but I am not sure what is the reason behind the error though.
我检查了我的路径中有我的ANT_HOME / ANDROID_HOME,但我不确定错误背后的原因是什么。
I am running windows 7 64 bit by the way 顺便说一句,我正在运行Windows 7 64位
Similar to the answer to this question , the solution for me was to 类似于这个问题的答案,我的解决方案是
$cordova platform remove android
$cordova platform add android
对我来说,这看起来像某种丢失的节点模块..你试过了吗?
npm install -g which
It seems your nodejs installation is broken. 看来你的nodejs安装已经破了。 It occurs when install/update from yum (for sample) failed.
从yum(样本)安装/更新失败时发生。 For my case, I simply deleted the broken modules from "/usr/lib/node_modules" and perfomed an install.
对于我的情况,我只是从“/ usr / lib / node_modules”中删除了已损坏的模块并执行了安装。
This happened to me today, too. 今天也发生在我身上。 I installed
which
but then the module chalk
was missing. 我安装了
which
但模块chalk
丢失了。
Doing an npm update
installed all the packages missing and it seems to be the right way to resolve. 执行
npm update
安装了所有丢失的软件包,这似乎是解决问题的正确方法。 (But why this happened is a mystery as node
was doing fine yesterday and I cannot recall any relevant changes.) (但是为什么这发生了一个谜,因为
node
昨天做得很好,我不记得任何相关的变化。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.