简体   繁体   English

找不到模块'哪个' - Cordova android

[英]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.

相关问题 科尔多瓦:找不到模块“ ./android_sdk” - Cordova: Cannot find module './android_sdk' Cordova 找不到模块 - Cordova cannot find module Cordova Android升级 - 找不到模块'lodash / object / assign'错误 - Cordova Android Upgrade - Cannot find module ‘lodash/object/assign’ Error 离子cordova构建android找不到模块../pages/Wallet/ - ionic cordova build android Cannot find module '../pages/Wallet/' cordova构建android失败:找不到模块'C:[…] \\ platforms \\ android \\ cordova \\ lib \\ AndroidStudio' - cordova build android fails: Cannot find module 'C:[…]\platforms\android\cordova\lib\AndroidStudio' 在Cordova android平台中,其中一个是app模块 - In Cordova android platform, which one is app module 无法在 Android 上使用 Cordova 和 Ionic 加载模块 - Cannot load module with Cordova and Ionic on Android Cordova构建失败,“无法找到模块lodash / object / assign” - Cordova build fails with “Cannot find module lodash/object/assign” Ionic Cordova Build prod:找不到模块“.” - 打字稿版本 >3 - Ionic Cordova Build prod: Cannot find module “.” - Typescript version >3 在cordova-android的CordovaLib编译上找不到符号ClientCertRequest - Cannot find symbol ClientCertRequest on CordovaLib compilation from cordova-android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM