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

to be honnest I don't know I am not part of ionic team. I am just a developer like you.

speedfl avatar Nov 21 '16 10:11 speedfl

@speedfl no problem. but after doing some research i found this blog http://blog.ionic.io/improvements-to-ionic-build-process/ everything looks ok but not able to see the gulp file run before lite-server runs.

gopi2mohan avatar Nov 21 '16 10:11 gopi2mohan

It seems like the build is failing and note reporting the outcome correctly.

Can you update the following packages so we can troubleshoot this better?

npm install -g ionic@latest
npm install @ionic/app-scripts@latest

Can you also append a --debug to the npm script for ionic:serve so we can see additional logging? That may provide a hint.

Thanks, Da

danbucholtz avatar Nov 21 '16 16:11 danbucholtz

@danbucholtz I got the out put i am using ubuntu16.04, So i forgot to use sudo command.

Now it is working fine thanks

gopi2mohan avatar Nov 22 '16 04:11 gopi2mohan

I am doing everything I can get from here but is still facing the same issue. I am also having build error when trying to build for android. This is what I get

_

cache taskArtifacts.bin (/Volumes/My Passport/ionic/hello/platforms/android/.gradle/2.13/taskArtifacts/taskArtifacts.bin) is corrupt. Discarding. _

_

FAILURE: Build failed with an exception.

  • What went wrong: Could not open cache taskArtifacts.bin (/Volumes/My Passport/ionic/hello/platforms/android/.gradle/2.13/taskArtifacts/taskArtifacts.bin).

Corrupted FreeListBlock 0 found in cache '/Volumes/My Passport/ionic/hello/platforms/android/.gradle/2.13/taskArtifacts/taskArtifacts.bin'.

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

_

Are this 2 issues related? I am really at a lost of what to do next.............any advice pls.........

sklaujb avatar Nov 22 '16 08:11 sklaujb

No one ??...........

sklaujb avatar Nov 23 '16 07:11 sklaujb

please try $ npm install ionic@latest -g $ npm install @ionic/app-scripts@latest --save-dev $ npm run ionic:build $ npm run ionic:serve

kevendra avatar Nov 26 '16 15:11 kevendra

i also have the same problem, i have tried to send the above commands, i attach the screen of error received (screen is referred to "npm install @ionic/app-scripts@latest") screenshot 10

gigetto03 avatar Nov 26 '16 17:11 gigetto03

I solved with npm run ionic:build

Thanks @danbucholtz After one week of frustration. You save my day. Merry Xmas

ShiroTeky avatar Dec 25 '16 18:12 ShiroTeky

solved by running npm run build Before ionic serve

Elrashid avatar Jan 01 '17 05:01 Elrashid

I am getting this error, despite of trying all possible steps shown here, writing here after frustrated 2 hours: Runtime Error Module build failed: Error: ENOENT: no such file or directory, open '/Users/Documents/IonicMaster/src/pages/menuthree/menuthree.js' at Error (native) Stack Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/Documents/IonicMaster/src/pages/menuthree/menuthree.js' at Error (native) at Object. (http://localhost:8100/build/main.js:97312:7) at webpack_require (http://localhost:8100/build/main.js:20:30) at Object. (http://localhost:8100/build/main.js:56476:79) at webpack_require (http://localhost:8100/build/main.js:20:30) at Object. (http://localhost:8100/build/main.js:97232:82) at webpack_require (http://localhost:8100/build/main.js:20:30) at Object. (http://localhost:8100/build/main.js:85905:73) at webpack_require (http://localhost:8100/build/main.js:20:30) at Object. (http://localhost:8100/build/main.js:105203:70) at webpack_require (http://localhost:8100/build/main.js:20:30) Ionic Framework: 2.0.0-rc.5 Ionic Native: 2.2.11 Ionic App Scripts: 1.0.0 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.4 OS Platform: macOS Sierra Navigator Platform: MacIntel User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Anyone know of any other solution, other then what is mentioned here.

amity203 avatar Jan 22 '17 23:01 amity203

Why it is looking for a .JS file instead of a .TS file

amity203 avatar Jan 22 '17 23:01 amity203

$ npm install ionic@latest -g $ npm install @ionic/app-scripts@latest --save-dev

the two commands above also fixes the live reload issue.

Endtry avatar Feb 19 '17 07:02 Endtry

I do run the build first and then execute ionice serve. And it works fine for me. And these are the commands: npm run build ionic serve

chpecson avatar Mar 21 '17 01:03 chpecson

npm run build in project folder solved for me.

npm -v 3.10.10 $ cordova -v 6.5.0 $ ionic -v 2.2.1 $ node -v v6.10.0

gacalves avatar Mar 22 '17 23:03 gacalves

In my case the problem was caused by the fact that my project was in a subfolder of a NTSF junction on Windows.

E.g.: c:/works/my.ionic.project

Where works is a NTFS junction to a directory on the same drive.

npm run build cannot find all necessary files but doesn't report any error to the user.

Don't know if this is a NPM issue or a Ionic CLI issue, maybe @danbucholtz (or others Ionic team members) could figure it out...

MorisNotari avatar Apr 17 '17 09:04 MorisNotari

EDIT: For some reason when I served from Node.js Cmd Prompt it worked, but from Git Bash it did not

I have had similar errors "Runtime Error Module build failed: Error: ENOENT: no such file or directory, open 'C:\Users\Youssef\Documents\App Dev\Ionic\Ionic CLI\Samples\tab-sample\tabApp3\src\app\main.js' at Error (native)"

My ionic info

Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.10.2
Xcode version: Not installed

I have tried running

npm install -g ionic@latest
npm install @ionic/app-scripts@latest
npm run ionic:build
npm run ionic:serve --debug

Here is the debug output that I think is causing the issue

debug_output

Basically the wepack loader is failing to load main.js Any help is appreciated!

@jgw96 @danbucholtz @brandyscarney

yhalwani avatar Apr 17 '17 15:04 yhalwani

@amity203 I had the same issue until I realised I was importing a component with a small typo

import {User} from "../models/user"

instead of

import {User} from "../models/User"

It was first when running ionic run android --device --prod I was presented with an error. The app worked without issues in the serve environment

sjosen avatar Apr 19 '17 17:04 sjosen

Actually we are missing index.html file here- www/index.html just copy and paste index file to resolve this issue- copy form src/index.html paste here www/index.html

hopefully that will for for you as this worked for me. also can see here on stack OverFlow
https://stackoverflow.com/questions/40669878/error-enoent-no-such-file-or-directory-open-in-ionic2

SanjayYadav90 avatar Jun 10 '17 11:06 SanjayYadav90