我能够去节点”LTS https://nodejs.org/en/“ 6.4.11 版本nvm https://github.com/creationix/nvm让事情顺利进行。
$ VER=v6.11.4
$ nvm install $VER
$ nvm alias default $VER
$ nvm use $VER
### now, sadly, we re-install everything to avoid incompatibilities and other issues.
$ mv node_modules node_modules.old
$ mv *.lock node_modules.old
$ npm install
$ npm -g install [email protected] /cdn-cgi/l/email-protection cordova@6 gulp
### the next two may not be needed but it's mostly harmless and maybe helpful
$ ionic platform remove android
$ ionic platform add android
现在,当运行这些相同的命令时,如果你幸运的话,你会收到警告:
✗ (node:15169) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
这不是崩溃......不,这不是崩溃......
最后,不用担心,在此之后还有其他令人兴奋的修复和不兼容问题值得期待。通常这些应该在其他问题中,但因为您可能也需要这些答案,所以我在这里记录了它们。
您可能还需要添加
ext.cdvCompileSdkVersion = 26
android {
buildToolsVersion "26.0.1"
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
以某种方式到你的构建。一种方法是将其放入名为的文件中build-extras.gradle
它住在platforms/android
.
未来读者(2018+)请注意:“26”并没有什么神奇之处 - 这是截至撰写本文时当前最高的 sdk 版本号。如果上述值不适合您,您可能应该在未来的世界中使用当前版本。
然而,由于任何事情platforms/
可能会被cordova删除cordova platform add/remove
模式,为了确保保留它,我将它放在该文件夹之外。然后在我的构建(只是一个 shell 脚本)中,我执行以下操作:
cp -up misc/build-extras.gradle platforms/android
ionic build android
现在我终于又开始做生意了。