Ionic-framework: ionic serve/build is not building main.js nor outputting any errors

Created on 6 Dec 2016  路  6Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

When working on a project running ionic serve runs into the issue below in the browser

http://localhost:8100/build/main.js Failed to load resource: the server responded with a status of 404 (Not Found)

And I do not see any errors in the logs terminal.

When running ionic build

[19:41:14]  uglifyjs failed: ENOENT: no such file or directory, open
            '/Users/alejandrom/cajitas-cooks-app/www/build/main.js'
[19:41:14]  ionic-app-script task: "build"
[19:41:14]  Error: ENOENT: no such file or directory, open '/Users/alejandrom/cajitas-cooks-app/www/build/main.js'

I also ran ionic-app-scripts transpile; it finishes without outputting any errors in the terminal

Expected behavior:

I would expect for the site to be served and the app to be built. Or to see errors explaining why the build failed.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.14
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: 1.9.0
ios-sim version: 5.0.9
OS: OS X El Capitan
Node Version: v6.7.0
Xcode version: Xcode 8.1 Build version 8B62

Most helpful comment

I had the same issue. At no point did I see any error message or warning, other than main.js not building. It did eventually come down to a bug in my code: I had an index.ts file that exported a path that didn't exist. Some kind of appropriate error message would have been greatly appreciated!

Here's my ionic info, for reference:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.12
OS: OS X El Capitan
Node Version: v7.1.0
Xcode version: Xcode 8.1 Build version 8B62

All 6 comments

I was able to get over this. I went back to a commit that worked and slowly added commits back while I had ionic serve running. When I added the troublesome commit I saw the error in the terminal/browser. At this point, if I shut down ionic serve and attempted to ionic serve again and the described behavior in the report above would happen (no errors would come up, just that it could not build main.js).

Since, through the method described above, I knew what the error was I went ahead and fixed it. This fixed the issues I had with ionic serve and ionic build.

I think there's a bug somewhere there; in this case it did not show the specific error of why main.js was unable to build. I don't think the information I have provided is enough to debug this issue so I will close it. Hopefully this is helpful to someone out there.

I had the same issue. At no point did I see any error message or warning, other than main.js not building. It did eventually come down to a bug in my code: I had an index.ts file that exported a path that didn't exist. Some kind of appropriate error message would have been greatly appreciated!

Here's my ionic info, for reference:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.12
OS: OS X El Capitan
Node Version: v7.1.0
Xcode version: Xcode 8.1 Build version 8B62

I'm going to reopen the issue; I think someone should take a look since other people are going to keep experiencing this behavior.

Can easily reproduce this now. Run ionic build android while ionic serve is running on a different terminal. The version you are serving to the browser often has the described main.js error. Restarting ionic serve fixes the issue.

This issue was moved to driftyco/ionic-cli#1782

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manucorporat picture manucorporat  路  3Comments

daveshirman picture daveshirman  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments