Cordova 找不到模块 [英] Cordova cannot find module

查看:46
本文介绍了Cordova 找不到模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了解决方案,但找不到任何有效的方法.

I allready searched for solutions but couldn't find anything that works.

我正在尝试使用cordova 构建/运行apk,但模拟器(以及我的手机)无法启动应用程序并且安装失败.我尝试重新创建项目并重新安装cordova,但遇到了这个问题:

I'm trying to build / run apk with cordova but the emulator (and also my phone) won't start the app and fail on installation. I tried to re-create the projet and re-install cordova but have this issue :

错误:找不到模块'C:\Users\...\AppData\Roaming\npm\node_modules\cordova\bin\cordova'

Error: Cannot find module 'C:\Users\...\AppData\Roaming\npm\node_modules\cordova\bin\cordova'

我也尝试过:

npm 缓存清理

没有任何效果,有人可以帮我吗?谢谢!

Nothing is working, can someone help me please ? Thank you !

推荐答案

我也遇到过类似的情况,错误信息如下:

I encountered the similar situation, here is the error information:

module.js:471
    throw err;
    ^

Error: Cannot find module 'C:\Users\MYUSERNAME\AppData\Roaming\npm\node_modules\cordova\bin\cordova'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3

这是在我使用以下命令升级我的cordova之后发生的:

It happened after I upgraded my cordova with the command:

npm install cordova -g

即使我单独运行cordova"命令,我也会得到同样的错误.

Even when I ran the "cordova" command solely, same error I could get.

最终通过完全重新安装cordova解决了:

Finally solved by reinstall the cordova completely :

npm uninstall cordova -g

然后

npm install cordova -g

这篇关于Cordova 找不到模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆