After serve no main.js


#1

Hi,
i have a new Laptop and install the newest Version of ionic2 oder Node.js. Then i created a blank new Project.
After “ionic serve” i got a White Screen in my Edge Browser and the Console says “can not get build/main.js”.

In my “www/build” Folder i have no main.js. Only a main.css and a polyfills.js file.

I don’t know whats the Problem.

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

Somebody has an idea?

Thanks


#2

Look back through the terminal log when you run ionic serve. There was probably a TypeScript error that halted the creation of the main.js file.


#3

i got no errors in the terminal log, no warnings. just a blank white page in the browser after “ionic serve”.
How can i change the log level or is there any chance of getting more informations?


#4

Sounds like a TypeScript error.

Could this be an Ahead-of-Time compiler issue? Are you trying to access private properties from your class in your view templates? If so, set these properties to be public instead: Cannot find main.js ios build.

You should be seeing the reporting screen in the browser though if you are running the latest version of Ionic 2.

Double check that you have also configured your app.module.ts file to list all pages/providers/pipes you may have created.

If that doesn’t work, try creating a new project and immediately run the ionic serve command to view that in the browser. If you still get a blank screen then it sounds as if there’s a problem with your environment configuration (which would entail having to uninstall/reinstall software and related dependencies).


#5

Try adding a platform
ionic platform add android or ionic platform add windows
maybe since you are on Windows, and a platform is not added automatically, that is an issue


#6

Just to add to the previous post double check your application platforms directory. What do you have installed there? If no windows or android directories then, like the previous poster mentioned this will be the culprit.


#7

Thanks for the answers. I check it at home later.
I have no plattform added. On my new laptop i install Node.Js and Ionic. Then i created a brand new project und run “ionic serve” and after that i only see a white screen.

So i test to add plattform und try it again.


#8

That, in all likelihood, is the issue then.

At the root of your Ionic project run the following commands:

ionic platform add android
ionic platform add windows

This way you have at least two platforms to build for.

Then test your app by running ionic serve - hopefully this should fix the white screen of death!


#9

I added both platforms, but still get the White Screen of Death.
There is no main.js in my Project/WWW/build Folder.


#10

I downgraded to RC3 but still same error.
Still have no idea:
New clean install of ionic, node and a new blank template project.


#11

as mentioned here: https://github.com/driftyco/ionic-app-scripts/blob/master/CHANGELOG.md

Delete main.dev.ts and main.prod.ts and create a main.ts file with the following content:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);

#12

I got the same problem because i updated my globale ionic with
npm install -g ionic@latest

but forgot to update my project with
npm install @ionic/app-scripts@latest --save-dev

You could try to delete all content in your www folder and try serve again if you haven’t done already

you really have tried rc.4? because your first post says rc.3


#13

Get that error with rc3 and rc4.
I deleted the www Folder, but still no main.js was created. I added a platform, but no main.js.
I reinstalled and install all componens, but everytime no main.js.


#14

I’d the same problem. The command “npm install @ionic/app-scripts@latest --save-dev” worked for me. But that I have to do this was nowhere documented on rc4 release.


#15

I have the same issue.
I have tried rc4 rc5 and rc6 to no avail.

 ordova CLI: 6.5.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: Windows 10
Node Version: v6.9.4
Xcode version: Not installed

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

makes no difference.


#16

In my case, running on Windows 10, my problem turns out to be the folder name where the files were located. I used a root folder of “c:!dev” (so as to always see the folder at the top of a Windows Explorer). The “!” was the problem, when changing the folder to “c:\dev”, “ionic serve” was able to build the main.js file and properly display the page. Not sure why, but hope this helps anyone who might not think of the folder name being part of the problem.


#17

You are right. Removing “!” from folder name solved the issue.
Thanks.


#18

Had you issue resolved ? I am getting the same problem.


#19

I used a project folder like “c:/!_dev/…”. I removed the ! and changed it so “c:/dev/…” and it worked.


#20

Thanks but now it is working here also.