常见报错
npm WARN checkPermissions Missing write access to
Solution方案一
方案二
- sudo npm i -g npm // 重新全局安装npm
- sudo chown -R your_user_name /usr/local/lib // 修改npm文件夹的权限
Downloading and extracting blank starter - failed!Error: socket hang up
Solution:
- 针对特定版本的解决方案:https://www.jianshu.com/p/6509070114e2
- sudo cnpm install -g ionic cordova // 需要记住的核心思想:能用cnpm尽量不要用npm
- ionic start myApp https://github.com/ionic-team/starters // 如果模板源的网站没有响应,则可以尝试直接去github上clone源代码
ERROR] The package.json file seems malformed.
Solution:In to of package.json at the root(base level), add ‘name’ key like "name": "My_App_Name",. Also at same base level add "author": "YourName",
如果需要安装依赖
cnpm install –save (安装完一些包之后要记得save,这个步骤十分容易忘记)
➜ ionicdemo ionic serve
Error: Cannot find module ‘tslint’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.(/Users/zzy824/ionicPrijects/ionicdemo/nodemodules/@ionic_app-scripts@3.1.8@@ionic/app-scripts/dist/lint/lint-factory.js:3:16)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)solution:
> rm -rf node_modules > npm restart > npm update > cnpm install --save
npm install出现”Unexpected end of JSON input while parsing near”
npm cache clean –force
- ionic中调用摄像头
提前准备plugman:一个专门为了cordova提供插件的命令行工具
npm installd -g plugman
第一步是安装ionic-native/core。所有用到Native的功能,这一步不能省。
npm install @ionic-native/core –save
- “/usr/bin/env: node: No such file or directory”
软链接文件:ln -s /usr/bin/nodejs /usr/bin/node
常用命令
1 | //下载依赖包 |
引用与参考