ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

ionic serve isn't copying contents into www.

Open satyandraguthula opened this issue 9 years ago • 5 comments

Following is the log 0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/nodejs', 1 verbose cli '/usr/bin/npm', 1 verbose cli 'run', 1 verbose cli 'ionic:serve', 1 verbose cli '--', 1 verbose cli '--v2', 1 verbose cli '--address', 1 verbose cli '0.0.0.0', 1 verbose cli '--port', 1 verbose cli '8100', 1 verbose cli '--livereload-port', 1 verbose cli '35729' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'preionic:serve', 'ionic:serve', 'postionic:serve' ] 5 info lifecycle ionic-hello-world@~preionic:serve: ionic-hello-world@ 6 silly lifecycle ionic-hello-world@~preionic:serve: no script for preionic:serve, continuing 7 info lifecycle ionic-hello-world@~ionic:serve: ionic-hello-world@ 8 verbose lifecycle ionic-hello-world@~ionic:serve: unsafe-perm in lifecycle true 9 verbose lifecycle ionic-hello-world@~ionic:serve: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/satyandra/sem2/cs727/[cs727]assignment2/test/node_modules/.bin:/home/satyandra/bin:/home/satyandra/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/etc/jdk1.8.0_121/bin:/etc/jdk1.8.0_121/db/bin:/etc/jdk1.8.0_121/jre/bin 10 verbose lifecycle ionic-hello-world@~ionic:serve: CWD: /home/satyandra/sem2/cs727/[cs727]assignment2/test 11 silly lifecycle ionic-hello-world@~ionic:serve: Args: [ '-c', 11 silly lifecycle 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"' ] 12 silly lifecycle ionic-hello-world@~ionic:serve: Returned: code: 1 signal: null 13 info lifecycle ionic-hello-world@~ionic:serve: Failed to exec ionic:serve script 14 verbose stack Error: ionic-hello-world@ ionic:serve: ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 14 verbose stack Exit status 1 14 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at EventEmitter.emit (events.js:191:7) 14 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at ChildProcess.emit (events.js:191:7) 14 verbose stack at maybeClose (internal/child_process.js:886:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 15 verbose pkgid ionic-hello-world@ 16 verbose cwd /home/satyandra/sem2/cs727/[cs727]assignment2/test 17 error Linux 4.8.0-41-generic 18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 19 error node v6.10.1 20 error npm v3.10.10 21 error code ELIFECYCLE 22 error ionic-hello-world@ ionic:serve: ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 22 error Exit status 1 23 error Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the ionic-hello-world package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 23 error You can get information on how to open an issue for this project with: 23 error npm bugs ionic-hello-world 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls ionic-hello-world 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ]

Following is the error it is throwing

ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"

[21:34:19] ionic-app-scripts 1.1.4 [21:34:19] watch started ... [21:34:19] build dev started ... [21:34:19] clean started ... [21:34:19] clean finished in 3 ms [21:34:19] copy started ... [21:34:19] transpile started ... [21:34:21] transpile finished in 2.53 s [21:34:21] preprocess started ... [21:34:21] preprocess finished in 1 ms [21:34:21] webpack started ... [21:34:21] copy finished in 2.63 s [21:34:29] webpack finished in 7.20 s [21:34:29] sass started ... [21:34:29] sass finished in 929 ms [21:34:29] postprocess started ... [21:34:29] postprocess finished in less than 1 ms [21:34:29] lint started ... [21:34:30] build dev finished in 10.70 s [21:34:30] watch ready in 10.85 s [21:34:30] dev server running: http://localhost:8100/

[21:34:31] lint finished in 1.42 s /home/satyandra/sem2/cs727/[cs727]assignment2/test/node_modules/@ionic/app-scripts/dist/dev-server/live-reload.js:27 var contentStr = content.toString(); ^

TypeError: Cannot read property 'toString' of undefined at Object.injectLiveReloadScript (/home/satyandra/sem2/cs727/[cs727]assignment2/test/node_modules/@ionic/app-scripts/dist/dev-server/live-reload.js:27:29) at ReadFileContext.callback (/home/satyandra/sem2/cs727/[cs727]assignment2/test/node_modules/@ionic/app-scripts/dist/dev-server/http-server.js:68:39) at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:366:13)

satyandraguthula avatar Mar 22 '17 15:03 satyandraguthula

Could you provide me with the output from ionic info from within your project directory? Thanks, this should help in troubleshooting.

jthoms1 avatar Mar 29 '17 15:03 jthoms1

I have an exactly same error. Following is the output of "ionic info":

Your system information:

 ordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.10.1
Xcode version: Not installed

Tried this didn't help:

ionic serve --address localhost

spa46 avatar Apr 01 '17 11:04 spa46

I found that if you remove this from the webpack config it works. Strange...

ionicWebpackFactory.getIonicEnvironmentPlugin(),

I am manually chunking in my setup.

twinj avatar Apr 12 '17 00:04 twinj

Well, my issue was sorted out. It seems the path length has a limit. My path "/home/satyandra/sem2/cs727/[cs727]assignment2/", as it seems, was beyond the limit. So when I made the project in a directory closer to home, it worked.

satyandraguthula avatar Aug 15 '17 17:08 satyandraguthula

Yeah, unfortunately Windows does have a file path length limit. npm 3 helps to mitigate this by deduping dependencies and flattening the dependency tree, but sometimes there still may be obscure errors due to this.

imhoffd avatar Aug 15 '17 20:08 imhoffd