[英]Error at module.js:341 when trying to add android platform to ionic from command line
I am going to use the Ionic framework to work on hybrid app development, so I installed all the necessary dependencies (node.js, cordova, etc.) and followed their Getting started section. 我将使用Ionic框架进行混合应用程序开发,因此我安装了所有必需的依赖项(node.js,cordova等),并遵循其入门部分。 Step number 3 simply involves running the following command within the app directory:
步骤3仅涉及在app目录中运行以下命令:
> ionic platform add android
However midway during the execution I got the following error: 但是在执行过程中途出现以下错误:
module.js:341
throw err;
^
Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\james.bonello\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\lib\config\core.js:2:10)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I ran > npm update
first and tried again to see if the update fixes any missing dependencies and such but the problem persisted. 我先运行了
> npm update
然后再次尝试查看更新是否解决了所有缺少的依赖关系,但问题仍然存在。
So, as the error clearly states, the module 'config-chain' is missing so I next ran 因此,正如错误明确指出的那样,缺少模块“配置链”,因此我接下来运行
> npm install config-chain
While that did install the module, the error somehow still persisted (identical to the previous one). 尽管确实安装了该模块,但错误仍然以某种方式持续存在(与上一个相同)。 I am not sure what to do next and I cannot understand why npm is not recognizing the 'config-chain' module now.
我不确定下一步该怎么做,也无法理解npm为什么现在无法识别“配置链”模块。 Any ideas?
有任何想法吗?
From what I can see, the missing package config-chain
is a dependency of the global package cordova
. 据我所知,缺少的程序包
config-chain
是全局程序包cordova
的依赖项。
You should re-install cordova: 您应该重新安装cordova:
npm cache clean
npm uninstall cordova -g
npm install cordova -g
IF the problem persists, you have to manually install the package inside cordova's modules: 如果问题仍然存在,则必须手动将软件包安装在cordova的模块中:
C:> cd Users\james.bonello\AppData\Roaming\npm\node_modules\cordova
C:> npm install config-chain
我安装了npm并成功运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.