Ionic常见问题
1.插件无法下载:npm ERR
解决方法1:
设置淘宝镜像
镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):
1.通过config命令
npm config set registry https://registry.npm.taobao.org
npm info underscore (如果上面配置正确这个命令会有字符串response)
2.命令行指定
npm --registry https://registry.npm.taobao.org info underscore
3.编辑 ~/.npmrc 加入下面内容,C:/Users/电脑名 路径下即可找到 ~/.npmrc ,打开 ~/.npmrc 替换 registry = https://registry.npm.taobao.org
registry = https://registry.npm.taobao.org
解决方法2:
用 https://www.npmjs.com/package... 切换多个来源,通过修改配置实现,同上述第三种方法,但是更好用~
npm install -g nrm
nrm ls
nrm use taobao
2.Plugin doesn't support
Plugin doesn't support this project's cordova-android version. cordova-android: 5.2.2, failed version requirement: >=6.3.0
强行升级cordova platform update android@6.3.0
或安装高版本cordova platform add android@6.3.0
会报这个错:cordovaProject.projectConfig.getFileResources is not a function
所以只能重新安装全局的cordova
cnpm install -g cordova
3.Could not find Gradle
运行打包命令时:ionic cordova build android
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
下载地址:https://services.gradle.org/d...
是下载all类型的哦~
路径到bin设置环境变量后即可
再次打包就可以用了~
4.建议顺序
这样就不会出现很多预料之外的错误了~
ionic start newApp
ionic cordova platform add android
ionic cordova build android
ionic cordova plugin add
5.sha1错误
npm ERR! code EINTEGRITY
npm ERR! sha1-W9Xj+4ADRFwk78= integrity checksum failed when using sha1: wanted sha1-W9Xj+4ADRmNRJnFwk78= but got sha1-0Fr
2MJupzQTl2f/UgSimztsAe6w=. (6833232 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jiaxin\AppData\Roaming\npm-cache\_logs\2017-12-26T10_02_20_344Z-debug.log
解决方法
npm cache clean --force
npm cache verify
npm install
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。