Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

[0.0.43]build dev failed #361

Closed
GTKSKY2014 opened this issue Nov 11, 2016 · 22 comments
Closed

[0.0.43]build dev failed #361

GTKSKY2014 opened this issue Nov 11, 2016 · 22 comments

Comments

@GTKSKY2014
Copy link

ionic start --v2 TestCode02
ionic serve

ionic-app-base@ ionic:serve /Users/caravan/Documents/IonicApp/TestCode02
ionic-app-scripts serve "[object Object]"

[12:32:43] ionic-app-scripts 0.0.43
[12:32:43] watch started ...
[12:32:43] build dev started ...
[12:32:43] clean started ...
[12:32:43] clean finished in less than 1 ms
[12:32:43] copy started ...
[12:32:43] transpile started ...
[12:32:46] build dev failed: Cannot read property 'length' of undefined
[12:32:46] copy finished in 3.04 s
[12:32:46] watch ready in 3.04 s
[12:32:46] dev server running: http://localhost:8100/

Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.7
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: 1.9.0
ios-sim version: 5.0.9
OS: OS X El Capitan
Node Version: v5.3.0
Xcode version: Xcode 8.0 Build version 8A218a

@jrierab
Copy link

jrierab commented Nov 11, 2016

Upgrading from a new tabs project with 0.0.42 (where dev failed also):

npm install @ionic/app-scripts@latest

produces an:

@ionic/[email protected]  invalid

Config:

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.7
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v4.2.6
Xcode version: Not installed

And dev build hangs without serving anything, nor giving an error:

> ionic-hello-world@ ionic:serve .../ionicTestBuild
> ionic-app-scripts serve "[object Object]"

[09:19:56]  ionic-app-scripts 0.0.43 
[09:19:56]  watch started ... 
[09:19:56]  build dev started ... 
[09:19:56]  clean started ... 
[09:19:56]  clean finished in 5 ms 
[09:19:56]  copy started ... 
[09:19:56]  transpile started ... 
[09:19:59]  transpile finished in 3.50 s 
[09:19:59]  webpack started ... 
[09:19:59]  copy finished in 3.63 s 
[09:20:09]  webpack finished in 9.87 s 
[09:20:09]  sass started ... 
[09:20:11]  sass finished in 1.82 s 
[09:20:11]  build dev finished in 15.22 s 
[09:20:11]  watch ready in 15.29 s 
[09:20:11]  dev server running: http://localhost:8100/ 

Starting with a new project:

ionic start testBuild43 --v2
cd testBuild43
ionic serve -c -s

Produces an error:

> ionic-hello-world@ ionic:serve /home/jordir/Programacio/ionic2/testBuild43
> ionic-app-scripts serve "[object Object]"

[09:36:46]  ionic-app-scripts 0.0.43 
[09:36:46]  watch started ... 
[09:36:46]  build dev started ... 
[09:36:46]  clean started ... 
[09:36:46]  clean finished in less than 1 ms 
[09:36:46]  copy started ... 
[09:36:46]  transpile started ... 
events.js:141
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRINUSE 0.0.0.0:53703
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1237:14)
at listen (net.js:1273:10)
at net.js:1382:9
at nextTickCallbackWith3Args (node.js:452:9)
at process._tickCallback (node.js:358:17)
at Function.Module.runMain (module.js:444:11)
at startup (node.js:136:18)
at node.js:966:3

@pensacola1989
Copy link

same problem,waiting for reply

@michael-brade
Copy link

Actually, it works for me if I

  • add declarations.d.ts to src/
  • make sure to use TypeScript 2.0.x (i.e., not 2.1.x) in package.json

@Aristona
Copy link

Aristona commented Nov 13, 2016

It happens because

program.emit(undefined, (path: string, data: string, writeByteOrderMark: boolean, onError: Function, sourceFiles: ts.SourceFile[])

sourceFiles is undefined.

You can open your node_modules/@ionic/app-scripts/dist/transpile.js and change line 82 to be like:

writeSourceFiles(context.fileCache, sourceFiles || []);

which is a temporary workaround for 0.0.43.

Edit: Nevermind. Have a look at #367

@fiznool
Copy link
Contributor

fiznool commented Nov 13, 2016 via email

@jrierab
Copy link

jrierab commented Nov 14, 2016

This still does not work for me.

I must insist that the error appears in a brand new project. In my case, @michael-brade solution (the declarations.d.ts and typescript dependencies) are already correct from the template.

Worse of all, the command:

 ionic serve -c -s

hangs forever on:

....
dev server running: http://localhost:8100/

without NEVER producing any apparent error, nor opening any browser window.

@jrierab
Copy link

jrierab commented Nov 15, 2016

It seems that the package.json is broken in the template. See ionic-team/ionic-cli#1660 (comment).

To fix, remove "ionic:build" and "ionic:serve" in the "scripts" part and leave it like that:

"scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch"
},    

It's commented https://github.com/driftyco/ionic-app-scripts#npm-scripts.

@kabus202
Copy link

@jrierab Not working for me?

What just happend here? Why can something be broken without any updates?

@kabus202
Copy link

kabus202 commented Nov 15, 2016

fix for me is to change
this:

"ionic:serve": "ionic-app-scripts serve"

into:

"ionic:serve": "ionic-app-scripts watch"

ionic-app-scripts 0.0.42
btw: you need to manually (re)load the page

@jrierab
Copy link

jrierab commented Nov 15, 2016

@kabus202 Like I said above, starting from a blank project, it never serves the page. It freezes without giving any error:

ionic start testBuild43again tabs --v2
cd testBuild43again
ionic serve -c -s

...
dev server running: http://localhost:8100/

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.7
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.9.1
Xcode version: Not installed

Your workaround freezes the same after building, but does not even try to serve the page.

So, to build, package.json must be like:

    "ionic:serve": "ionic-app-scripts serve"

Then, I have to Ctrl-C and edit package.json to allow serving the page (but then it doesn't build):

    "serve": "ionic-app-scripts serve"

This "workaround" works for me, but it is not very productive :-)

@kabus202
Copy link

kabus202 commented Nov 15, 2016

What happens if you change serve into this:

"serve": "ionic-app-scripts watch"

@jrierab
Copy link

jrierab commented Nov 15, 2016

It serves the page, but does not run the build process.

@ngSunil
Copy link

ngSunil commented Nov 15, 2016

Modifying the scripts in package.json resulted in:

Error: ENOENT: no such file or directory, open '/Volumes/Macintosh HD 2/Lab/ionic2/myApp/www/index.html'

Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.44
ios-deploy version: Not installed
ios-sim version: 5.0.6
OS: macOS Sierra
Node Version: v7.1.0
Xcode version: Xcode 8.1 Build version 8B62

@jrierab
Copy link

jrierab commented Nov 16, 2016

@ngSunil This could be because it is not building, so it does not copy src files (index.html) nor generates main.js in www.

In my case, I must alternate modifying the scripts to build/serve the page. See my comment here. But I am on Ubuntu.

@NoGoout
Copy link

NoGoout commented Nov 16, 2016

Now that it's running, I just upgraded my NPM to 4.0.2, I think it should be the NPM version that caused the problem, thanks guys :)

@jrierab
Copy link

jrierab commented Nov 16, 2016

Npm 3.10.9 is the version which comes with last node LTS 6.9.1. And it is the version I was using, and the build process fails with it...

Installing npm 4.0.2 as @NoGoout suggested did the trick:

sudo npm install [email protected] -g

However, in Ubuntu, the default browser does not automatically open the page (I must start it manually, then it reloads when source is modified, and it is very FAST). Moreover, I should kill the script with Ctrl-C (q and exit commands are not recognized; no command is recognized as it used to be). But these are minor annoyances.

BTW, this is true also for the 0.0.44 version of the scripts.

@danbucholtz
Copy link
Contributor

danbucholtz commented Nov 18, 2016

Make sure you are running the latest CLI. npm install -g ionic@latest. That may help.

Thanks,
Dan

@Yermo
Copy link

Yermo commented Nov 25, 2016

I am running the latest (as of 2016-11-25 12:15)

$ sudo npm install -g ionic@latest

I have created a test project.

$ ionic start ModuleTest --v2

Attempting to serve the project causes the hang.

$ cd ModuleTest
$ ionic serve

It hangs at a newly displayed line 'dev server running'. (Haven't seen that line displayed in earlier versions)

[12:22:34]  ionic-app-scripts 0.0.45 
[12:22:34]  watch started ... 
[12:22:34]  build dev started ... 
[12:22:34]  clean started ... 
[12:22:34]  clean finished in 5 ms 
[12:22:34]  copy started ... 
[12:22:34]  transpile started ... 
[12:22:36]  transpile finished in 2.76 s 
[12:22:36]  webpack started ... 
[12:22:37]  copy finished in 2.93 s 
[12:22:42]  webpack finished in 6.01 s 
[12:22:42]  sass started ... 
[12:22:44]  sass finished in 1.31 s 
[12:22:44]  build dev finished in 10.12 s 
[12:22:44]  watch ready in 10.16 s 
[12:22:44]  dev server running: http://localhost:8100/ 

I have a project scaffolded using an earlier version of ionic which still works. I notice that the package.json file is different. Notably this line:

"ionic:serve": "ionic-app-scripts serve"

Removing it and replacing it with:

"watch": "ionic-app-scripts watch",
"serve:before": "watch"

Causes 'ionic serve' to behave correctly again and launch the app in a browser.

I hope this is of some help. It seems the latest ionic does not generate a correct package.json file.

$ ionic info 

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 3.13
Node Version: v5.6.0
Xcode version: Not installed

@danbucholtz
Copy link
Contributor

@Yermo,

Can you install the latest ionic. That should resolve it (I think).

npm install -g ionic@latest

Thanks,
Dan

@danbucholtz
Copy link
Contributor

I don't recommend changing the package.json script section. It is the way it is for a reason. Once you start changing it we cannot provide support. It should contain:

"ionic:serve": "ionic-app-scripts serve"
"ionic:build": "ionic-app-scripts build"

@danbucholtz
Copy link
Contributor

@Aristona and @tycho01,

Any idea why they sourceFiles array is null in your case? Are you using Typescript 2.1? We landed a PR to fix this regression. Otherwise, I am confused why you're seeing this in 2.0.x.

Thanks,
Dan

@KiaraGrouwstra
Copy link
Contributor

TS 2.1: tried (really wanted to enable that async/await support with an ES5 target, since using an ES6 target requires disabling uglify), but rolled back to TS 2.0.10 since anything from 2.1 appeared unstable for me.
The sourceFiles array appeared to have turned out as undefined because calls to this function from what I could find all seemed to be missing this last parameter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests