I've installed ionic and cordova but when I created an application and tried to run it i get this in terminal-
ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] [19:17:47] ionic-app-scripts 3.1.11
[app-scripts] [19:17:47] watch started ...
[app-scripts] [19:17:47] build dev started ...
[app-scripts] [19:17:47] clean started ...
[app-scripts] [19:17:47] clean finished in 3 ms
[app-scripts] [19:17:47] copy started ...
[app-scripts] [19:17:47] deeplinks started ...
[app-scripts] [19:17:47] copy finished in 13 ms
[app-scripts] [19:17:47] deeplinks finished in 14 ms
[app-scripts] [19:17:47] transpile started ...
[app-scripts] [19:17:52] transpile finished in 5.34 s
[app-scripts] [19:17:52] preprocess started ...
[app-scripts] [19:17:52] preprocess finished in less than 1 ms
[app-scripts] [19:17:52] webpack started ...
[app-scripts] [19:17:58] webpack finished in 6.42 s
[app-scripts] [19:17:58] sass started ...
[app-scripts] Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[app-scripts] [19:18:00] sass finished in 1.36 s
[app-scripts] [19:18:00] postprocess started ...
[INFO] Development server running!
Local: http://localhost:8100
External: http://192.168.0.9:8100
DevApp: TestApp#8100 on heath
Use Ctrl+C to quit this process
[INFO] Browser window opened to http://localhost:8100!
[app-scripts] [19:18:00] watch ready in 13.45 s
[app-scripts] [19:18:01] Failed to load index.html
and in browser i'm getting 'try again later'.
How do i resolve this?
I had the same error on my system with the following specs:
$ ionic info
✔ Gathering environment info - done!
[WARN] You are not in an Ionic project directory. Project context may be missing.
Ionic:
ionic (Ionic CLI) : 4.1.2
System:
NodeJS : v8.11.4
npm : 5.6.0
OS : macOS High Sierra
I resolved it by running the following command in the project folder:
npm install
Sometimes it may happen due to insufficient write permissions to the source files like index.html
To solve this in linux you can follow any one of the following 2 ways.
1: Run ionic serve command using superuser permissions.
i.e. use sudo ionic serve instead of ionic serve
2: Change the permissions of the project folder (add write permission to all users). This can be done by using chmod command ->
sudo chmod a+w name_of_project_folder
npm update worked for me - windows 10
Related
I can't run app on Android device it is not giving any error. Here is the output of terminal;
Running app-scripts build: --platform android --target cordova
[13:00:25] build dev started ...
[13:00:25] clean started ...
[13:00:25] clean finished in 24 ms
[13:00:25] copy started ...
[13:00:25] deeplinks started ...
[13:00:25] deeplinks finished in 130 ms
[13:00:25] transpile started ...
[13:00:31] transpile finished in 5.76 s
[13:00:31] preprocess started ...
[13:00:31] preprocess finished in 1 ms
[13:00:31] webpack started ...
[13:00:31] copy finished in 6.35 s
[13:00:41] webpack finished in 10.48 s
[13:00:41] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[13:00:44] sass finished in 2.45 s
[13:00:44] postprocess started ...
[13:00:44] postprocess finished in 19 ms
[13:00:44] lint started ...
[13:00:44] build dev finished in 19.37 s
> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\umutg\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk-10
(node:3684) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Requirements check failed for JDK 1.8 or greater
(node:3684) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
I think It does not see device, It does not work on another device or emulator. I create new app for trying it's same.
It's about JDK V 10, I uninstalled it and works fine.
I have recently been trying to ionic labs view a try. From the docs, its as simple as the command ionic serve --lab . But this only shows the normal ionic serve view not android and iphone view . I do not see any errors.
$ ionic serve -l
> ionic-hello-world# ionic:serve /home/raj/ionic/bookemon
> ionic-app-scripts serve "--v2" "--lab" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
[12:10:35] ionic-app-scripts 1.0.0
[12:10:35] watch started ...
[12:10:35] build dev started ...
[12:10:35] clean started ...
[12:10:35] clean finished in 6 ms
[12:10:35] copy started ...
[12:10:35] transpile started ...
[12:10:39] transpile finished in 3.58 s
[12:10:39] webpack started ...
[12:10:39] copy finished in 3.74 s
[12:10:46] webpack finished in 6.89 s
[12:10:46] sass started ...
[12:10:47] sass finished in 719 ms
[12:10:47] build dev finished in 11.23 s
[12:10:47] watch ready in 11.31 s
[12:10:47] dev server running: http://localhost:8100/
This is my ionic info
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.6
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.2.1
Xcode version: Not installed
Not sure whats going on here. I tried reinstalling ionic and npm_modules but its not working. Any help? Thanks in advance.
Are you sure that you are opening http://localhost:8101/ionic-lab and NOT just http://localhost:8101 ?
Run ionic serve --lab or ionic serve -l
Goto http://localhost:8101/ionic-lab
Note
localhost:8101 loads the normal view and
localhost:8101/ionic-lab loads the view with options to various platform
"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "watch",
"deploy:before": "build",
"build:before": "build",
"run:before": "watch"
}
In package.json change scripts to above and run ionic serve -l
i think ionic serve -l doesn't work since ionic 2 using
ionic-app-scripts.
while, them using ionic view app, for live test.
check here https://play.google.com/store/apps/details?id=com.ionic.viewapp&hl=en
In the project, ionic serve show:
vega#vega-linux:/opt/projetos/myPorject$ ionic serve
> ionic-hello-world# ionic:serve /opt/projetos/myPorject
> ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
keywords if/then/else require v5 option
[16:28:19] ionic-app-scripts 0.0.47
[16:28:20] watch started ...
[16:28:20] build dev started ...
[16:28:20] clean started ...
[16:28:20] clean finished in 6 ms
[16:28:20] copy started ...
[16:28:20] transpile started ...
[16:28:22] transpile finished in 2.91 s
[16:28:22] webpack started ...
[16:28:23] copy finished in 3.06 s
[16:28:30] webpack finished in 7.81 s
[16:28:30] sass started ...
[16:28:32] sass finished in 1.42 s
[16:28:32] build dev finished in 12.18 s
[16:28:32] watch ready in 12.25 s
[16:28:32] dev server running: http://localhost:8100/
And the browser not open.
My system
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.4.0
Xcode version: Not installed
Why the ionic serve don't show ionic $?
In ionic 1 show:
vega#vega-linux:/opt/projetos/teste$ ionic serve
Running live reload server: http://192.168.2.103:35729
Watching: www/**/*, !www/lib/**/*, !www/**/*.map
√ Running dev server: http://192.168.2.103:8100
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
ionic $
But not in ionic2.
try this code
ionic serve --address=localhost
First try this command line:
npm run ionic:serve
and if does't help try the second one:
npm install --save-dev #ionic/app-scripts#latest
then
ionic serve
I create and run an ionic project using
ionic start test1 blank --v2
cd test1
ionic serve
And I get:
[13:48:30] ionic-app-scripts 0.0.42
[13:48:30] watch started ...
[13:48:30] build dev started ...
[13:48:30] clean started ...
[13:48:30] clean finished in 1 ms
[13:48:30] copy started ...
[13:48:30] transpile started ...
[13:48:34] transpile finished in 4.04 s
[13:48:34] webpack started ...
[13:48:34] build dev failed: Cannot find module '../util/Logger'
[13:48:35] copy finished in 4.13 s
[13:48:35] watch ready in 4.14 s
I tried to remove the node-modules directory and make "npm install" to rebuild the modules, but with the same result. (even reinstalled ionic framefork)
I have a Linux Mint 18.
I have walked through the tutorial instructions to set up cordova and ionic. I can successfully run the app in development but get this error when building ios. Any ideas? Tried updating node and cordova.
sudo ionic build ios
Running 'build:before' gulp task before build
[11:16:00] Starting 'clean'...
[11:16:00] Finished 'clean' after 47 ms
[11:16:00] Starting 'build'...
[11:16:00] Starting 'sass'...
[11:16:00] Starting 'html'...
[11:16:00] Starting 'fonts'...
[11:16:00] Starting 'scripts'...
[11:16:00] Finished 'scripts' after 45 ms
[11:16:00] Finished 'html' after 51 ms
[11:16:00] Finished 'fonts' after 54 ms
[11:16:00] Finished 'sass' after 770 ms
[11:16:07] Finished 'build' after 7.18 s
[11:16:07] Starting 'build:before'...
[11:16:07] Finished 'build:before' after 11 μs
• You're trying to build for ios but don't have the platform installed yet.
∆ Installing ios for you.
Installing cordova-plugin-device
Installing cordova-plugin-console
Installing cordova-plugin-whitelist
Installing cordova-plugin-splashscreen
Installing cordova-plugin-statusbar
Installing ionic-plugin-keyboard
Error: Command failed: /bin/sh -c cordova platform add ios
Error: Platform ios already added.
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:4
69:12)
First of all, it seems you have some issues on ios platform installation, try removing it and adding it back to your development space.
Run command ionic platform remove ios && ionic platform add ios before trying to build for ios.
Second, you need Mac Operating system to build ios apps, as it has dependencies on XCode (A native software) to build.
Third, if you still have the same iussue, then it could be due to a bug discribed here. https://github.com/driftyco/ionic-cli/issues/772
Try sudo npm install -g cordova and rerun the build.
Good luck.