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

Ionic serve error: Error: ENOENT: no such file or directory, open '/home/.../IonicTest/www/index.html'

Open pdrosos opened this issue 10 years ago • 63 comments

Hi,

I have just removed the previous version of ionic cli and installed the new one: npm uninstall -g ionic npm cache clean npm install -g ionic

and started a new project: ionic start IonicTest --v2

The project is generated with the latest ionic-angular 2.0.0-rc.0, but when I go to the project directory and run ionic serve, I see an error in the browser: Error: ENOENT: no such file or directory, open '/home/pavlina/IonicTest/www/index.html'

CC @jgw96 @danbucholtz @brandyscarney

pdrosos avatar Sep 28 '16 10:09 pdrosos

Yes! captura de tela de 2016-10-06 11-40-11

Thank you @danbucholtz !

lucascardoso avatar Oct 06 '16 14:10 lucascardoso

@lucascardoso, Thanks!

Can you run npm run build and give me the entire console output? I don't have enough to work off of right now.

Thanks, Dan

danbucholtz avatar Oct 06 '16 14:10 danbucholtz

@danbucholtz, this is the output. captura de tela de 2016-10-06 13-08-22

lucascardoso avatar Oct 06 '16 16:10 lucascardoso

@lucascardoso,

What do your package.json scripts section look like?

To compare, this is how a fresh Ionic app looks when I run that command:

$ npm run build --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/Users/dan/npm/bin/npm',
npm verb cli   'run',
npm verb cli   'build',
npm verb cli   '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'prebuild', 'build', 'postbuild' ]
npm info lifecycle ionic-hello-world@~prebuild: ionic-hello-world@
npm info lifecycle ionic-hello-world@~build: ionic-hello-world@

> ionic-hello-world@ build /Users/dan/Dev/myApp2
> ionic-app-scripts build

[11:17:27]  ionic-app-scripts 0.0.29
[11:17:27]  build prod started ...
[11:17:27]  clean started ...
[11:17:27]  clean finished in 11 ms
[11:17:27]  copy started ...
[11:17:27]  ngc started ...
[11:17:27]  lint started ...
[11:17:27]  copy finished in 35 ms
[11:17:27]  lint finished in 365 ms
...

Thanks, Dan

danbucholtz avatar Oct 06 '16 16:10 danbucholtz

It looks like you may have installed npm with ignore-scripts.

http://blog.npmjs.org/post/141702881055/package-install-scripts-vulnerability

Thanks, Dan

danbucholtz avatar Oct 06 '16 16:10 danbucholtz

@danbucholtz, apparently this normal for package.json file. I have this script installed ignore. captura de tela de 2016-10-06 13-29-12

Thank you!

lucascardoso avatar Oct 06 '16 16:10 lucascardoso

@danbucholtz, It should create the index.html file when running the command ionic serve the first time?

This is the log that appears when running the ionic serve captura de tela de 2016-10-06 13-51-46

Thank you!

lucascardoso avatar Oct 06 '16 16:10 lucascardoso

Your issues are likely do to your setup. Can you run npm run build? That will build everything and get it to a good state. If it doesn't run, the script ignore thing is still not quite right.

Thanks, Dan

danbucholtz avatar Oct 06 '16 17:10 danbucholtz

@danbucholtz, thank you so much! It worked for me! :smile: I ran the command npm config set ignore-scripts false and then I ran the command npm run build and worked as you had shown before

> ionic-hello-world@ build /home/lucas-cardoso/code/ionic/test5
> ionic-app-scripts build

[14:29:05]  ionic-app-scripts 0.0.30
[14:29:05]  build prod started ...
[14:29:05]  clean started ...
[14:29:05]  clean finished in 10 ms
[14:29:05]  copy started ...
[14:29:05]  ngc started ...
[14:29:05]  lint started ...
[14:29:05]  copy finished in 50 ms
[14:29:05]  lint finished in 633 ms
[14:29:20]  ngc finished in 15.59 s
[14:29:20]  bundle prod started ...
[14:29:27]  bundle prod finished in 7.33 s
[14:29:27]  sass started ...
[14:29:29]  sass finished in 1.33 s
[14:29:29]  minify started ...
[14:29:29]  cleancss started ...
[14:29:29]  uglifyjs started ...
[14:29:42]  uglifyjs finished in 12.82 s
[14:29:42]  cleancss finished in 12.82 s
[14:29:42]  minify finished in 12.82 s
[14:29:42]  build prod finished in 37.09 s

lucascardoso avatar Oct 06 '16 17:10 lucascardoso

@danbucholtz sir these didnt work for me.. could you help me please?

gittt

ghost avatar Oct 06 '16 21:10 ghost

@jthoms1, ^, what do you think of that?

CC: @blackkaiken

Thanks, Dan

danbucholtz avatar Oct 06 '16 21:10 danbucholtz

@jthoms1 adsiz11

here is ionic info also... Does anyone help me?

one recycler view on native android with tons of code ... i want ionic with angular 2 :)

note: i got this error after running npm install -g cordova@latest too

ghost avatar Oct 07 '16 22:10 ghost

"npm ls -g ionic" here is the results.. ionic11

ghost avatar Oct 08 '16 09:10 ghost

Discard the below. Pages show up after updating "@ionic/app-scripts": "^0.0.34" from 0.0.33 The following post was helpful. http://blog.ionic.io/ionic-2-rc-weekend-updates/

`

ionic-app-scripts watch

[22:12:26] ionic-app-scripts 0.0.33 [22:12:26] watch started ... [22:12:26] build dev started ... [22:12:26] clean started ... [22:12:26] clean finished in 11 ms [22:12:26] copy started ... [22:12:26] transpile started ... [22:12:26] lint started ... [22:12:28] lint finished in 1.75 s [22:12:30] transpile finished in 3.88 s [22:12:30] bundle started ... [22:12:30] copy finished in 3.96 s [22:12:40] bundle finished in 10.36 s [22:12:40] sass started ... [22:12:42] sass finished in 2.04 s [22:12:42] build dev finished in 16.31 s [22:12:42] watch ready in 16.39 s Running live reload server: http://localhost:35729 Watching: www//*, !www/lib//, !www/__/.map √ Running dev server: http://localhost: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 serve --> In browser Getting Error: ENOENT: no such file or directory, open ..index.html

www contains assets build index.html manifest.json service-worker.js

ionic -v 2.1.1 node 6.7.0 npm 3.10.3

Let me know if any further details would be helpful

kkganesan avatar Oct 15 '16 02:10 kkganesan

Solution!!!!!!!!!!!!!!!!!!!!!!!!

"scripts": { "build": "ionic-app-scripts build", "watch": "ionic-app-scripts watch", "serve:before": "watch", "emulate:before": "build", "deploy:before": "build", "build:before": "build", "run:before": "build" }

in your package.json

speedfl avatar Nov 15 '16 07:11 speedfl

@speedfl thanks it solved for me. but this is not getting added by default when we create project.

gopi2mohan avatar Nov 16 '16 05:11 gopi2mohan

Hi, I am still having this problem and is really frustrating.......any can help ? This is my ionic info

Cordova CLI: 6.3.1 Ionic Framework Version: 2.0.0-rc.3 Ionic CLI Version: 2.1.0 Ionic App Lib Version: 2.1.0-beta.1 ios-deploy version: Not installed ios-sim version: 5.0.6 OS: Mac OS X El Capitan Node Version: v7.0.0 Xcode version: Xcode 7.3.1 Build version 7D1014

sklaujb avatar Nov 21 '16 09:11 sklaujb

@sklaubjb can you show your package.json

speedfl avatar Nov 21 '16 09:11 speedfl

Hello speedfl, this is the package.json, I tried to change it to what you recommended but is giving me error

{ "name": "ionic-hello-world", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/common": "2.1.1", "@angular/compiler": "2.1.1", "@angular/compiler-cli": "2.1.1", "@angular/core": "2.1.1", "@angular/forms": "2.1.1", "@angular/http": "2.1.1", "@angular/platform-browser": "2.1.1", "@angular/platform-browser-dynamic": "2.1.1", "@angular/platform-server": "2.1.1", "@ionic/storage": "1.1.6", "ionic-angular": "2.0.0-rc.3", "ionic-native": "2.2.3", "ionicons": "3.0.0", "rxjs": "5.0.0-beta.12", "zone.js": "0.6.26" }, "devDependencies": { "@ionic/app-scripts": "0.0.45", "typescript": "2.0.6" }, "cordovaPlugins": [ "cordova-plugin-device", "cordova-plugin-console", "cordova-plugin-whitelist", "cordova-plugin-splashscreen", "cordova-plugin-statusbar", "ionic-plugin-keyboard" ], "cordovaPlatforms": [ "ios", { "platform": "ios", "version": "", "locator": "ios" } ], "description": "NewdotScanner: An Ionic project" }

sklaujb avatar Nov 21 '16 09:11 sklaujb

@speedfl i too getting the same issue. my package.json is also same as @sklaujb but if i update my "scripts": { "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" },

into this

"scripts": { "build": "ionic-app-scripts build", "watch": "ionic-app-scripts watch", "serve:before": "watch", "emulate:before": "build", "deploy:before": "build", "build:before": "build", "run:before": "build" }

everything works fine but why it is not automatically generated by ionic when creating the project

gopi2mohan avatar Nov 21 '16 09:11 gopi2mohan