可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
My Ionic info:
cli packages: (/usr/lib/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 3.1.0
Cordova Platforms : browser 4.1.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v6.9.0
npm : 3.10.8
OS : Linux 4.4
Ionic serve is working fine, but does not detect any file changes!
The problem appears only for Ionic v3 and v2 projects.
My Ionic v1 projects are working fine.
回答1:
For update changes in platform file you have to run ionic cordova prepare and then run ionic serve it works..
ionic cordova prepare copy all files of www into platform directory that will reflect in your apk or ipa
回答2:
Try like this
ionic serve --verbose
=>didn’t work, there were errors;
npm run ionic:build --verbose
=>ran, finnished with OK.
回答3:
When I use ionic cli build app(ionic3 + angular5),same problem happened to me.I updated '@ionic/app-scripts' to version '3.1.6',then problem solved
回答4:
Use "npm install" and then "gulp build" & "gulp serve". Also make sure you update all the dependencies. Check versions of your dependencies by "ionic info".
回答5:
Try npm run ionic:serve. Similar issue occurred when installing the latest cordova update.
回答6:
Try below steps.. May be it will help
npm install -g ionic@latest
npm install @ionic/app-scripts@latest --save-dev
npm install ionic-angular@latest --save
ionic serve
回答7:
Please use these commands in your project.
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p --system
And again run ionic serve
回答8:
Delete the node_modules
folder and then use the command
npm install
followed by
ionic serve--verbose
Hope that it works fine.
回答9:
You should not use "sudo" with any of the ionic/npm commands. If it throws error without "sudo", then you can fix it by changing the owner of the npm packages, using the command below:
sudo chown -R $(whoami) ~/.npm
回答10:
my configurations for running ionic 3 application:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.7
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.2.1
npm : 5.5.0
OS : Linux 4.4
Environment Variables:
ANDROID_HOME : /root/Android/Sdk
Misc:
backend : pro
回答11:
Use these commands in your prompt.
npm cache clear --force
rm -rf node_modules/
npm install -d
回答12:
The only thing that works for me, after check out node/npm installs, was:
Enable "update on reload" on chrome://inspect/#service-workers.
回答13:
Install ws:
npm install ws@3.3.2 --save-dev --save-exact
回答14:
In ionic 3 you have to type:
cordova run android
or cordova run ios
, to deploy your build in
device.
cordova build android
or cordova build ios
, for build only.
回答15:
Have you tried using this cmd
npm run ionic:serve
回答16:
I think your prob is the
NODE version (6.9.1) ..
can you just try to upgrade to 9.1.0 or more?
回答17:
My answers works. My machine is also having a different package of Node which I forgot about in the first place.
So I've removed node_modules using:
sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.
To make things less complicated with all cli - head up back https://nodejs.org/ and install back the LTS package
Uninstall Node from brew
re-install node.js using conventional way using the installer