Cordova 4.3.0 - build command returns error Cannot find module 'Q'

微笑、不失礼 提交于 2019-12-03 07:55:13

There was a bug and I have released a patch to it:

Apache Cordova ios - Git Repository

This is a bug shown on case-sensitive systems such as Unix, Linux and some OS X (if set as case-sensitive).

So far, to fix it, you have to locate those files containing a line like this:

 Q = require('Q')

You can locate the files while standing on your project directory using grep:

grep -HnrI "require('Q" *;

then, use any text editor to manually change the mentioned line to:

Q = require('q')

Alternatively you can edit the related files on a more straight forward way by running the following command on your project directory:

grep -rl "require('Q" * | xargs sed -i "" "s/'Q'/'q'/g";

The single line above searches and edits the files that need the change.

Removing and then re-adding the platform again also works:

cordova platform remove ios
cordova platform add ios

Now you can cordova build ios :)

As mentioned by MeV this was a bug.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!