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

production build (--prod) fails (with blank starter template too) #1283

Open
big-r81 opened this issue Oct 16, 2017 · 3 comments
Open

production build (--prod) fails (with blank starter template too) #1283

big-r81 opened this issue Oct 16, 2017 · 3 comments

Comments

@big-r81
Copy link

big-r81 commented Oct 16, 2017

Short description of the problem:

Trying to create a production build for my project fails with an error.

What behavior are you expecting?

The production build should pass without errors (with a new blank template too).

Steps to reproduce:

So i created an empty project with:

ionic start prod blank

Going into the new project dir i started a new production build

ionic build --prod

The output is the following:

[INFO] Running app-scripts build: --prod
       
[11:57:49]  build prod started ... 
[11:57:49]  clean started ... 
[11:57:49]  clean finished in 1 ms 
[11:57:49]  copy started ... 
[11:57:49]  deeplinks started ... 
[11:57:49]  deeplinks finished in 31 ms 
[11:57:49]  ngc started ... 
[11:57:57]  ngc finished in 8.31 s 
[11:57:57]  preprocess started ... 
[11:57:57]  copy finished in 8.41 s 
[11:57:57]  preprocess finished in 128 ms 
[11:57:57]  webpack started ... 
[11:58:25]  webpack finished in 27.75 s 
[11:58:25]  uglifyjs started ... 
[11:58:25]  sass started ... 
[11:58:27]  sass finished in 1.85 s 
[11:58:27]  cleancss started ... 
[11:58:37]  cleancss finished in 10.32 s 
[11:58:42]  uglifyjs finished in 16.88 s 
[11:58:42]  postprocess started ... 

There is no "postprocess finished" message so i ran

npm run ionic:build --prod

Then i got the following message:

> [email protected] ionic:build /Users/big-r/Documents/Developer/prototype/prod
> ionic-app-scripts build

[12:00:02]  ionic-app-scripts 3.0.0 
[12:00:02]  build prod started ... 
[12:00:02]  clean started ... 
[12:00:02]  clean finished in 2 ms 
[12:00:02]  copy started ... 
[12:00:02]  deeplinks started ... 
[12:00:03]  deeplinks finished in 33 ms 
[12:00:03]  ngc started ... 
[12:00:09]  ngc finished in 6.45 s 
[12:00:09]  preprocess started ... 
[12:00:09]  copy finished in 6.57 s 
[12:00:09]  preprocess finished in 104 ms 
[12:00:09]  webpack started ... 
[12:00:33]  webpack finished in 23.87 s 
[12:00:33]  uglifyjs started ... 
[12:00:33]  sass started ... 
[12:00:35]  sass finished in 1.66 s 
[12:00:35]  cleancss started ... 
[12:00:45]  cleancss finished in 10.24 s 
[12:00:49]  uglifyjs finished in 15.79 s 
[12:00:49]  postprocess started ... 
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/Users/big-r/Documents/Developer/prototype/prod/www/build/main.js.map'
    at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] ionic:build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/big-r/.npm/_logs/2017-10-16T10_00_49_372Z-debug.log

Here is the content of the log file:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node@6/6.11.4_1/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'ionic:build',
1 verbose cli   '--prod' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preionic:build', 'ionic:build', 'postionic:build' ]
5 info lifecycle [email protected]~preionic:build: [email protected]
6 info lifecycle [email protected]~ionic:build: [email protected]
7 verbose lifecycle [email protected]~ionic:build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~ionic:build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/big-r/Documents/Developer/prototype/prod/node_modules/.bin:/usr/local/opt/node@6/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
9 verbose lifecycle [email protected]~ionic:build: CWD: /Users/big-r/Documents/Developer/prototype/prod
10 silly lifecycle [email protected]~ionic:build: Args: [ '-c', 'ionic-app-scripts build' ]
11 silly lifecycle [email protected]~ionic:build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~ionic:build: Failed to exec ionic:build script
13 verbose stack Error: [email protected] ionic:build: `ionic-app-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:920:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/big-r/Documents/Developer/prototype/prod
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node@6/6.11.4_1/bin/node" "/usr/local/bin/npm" "run" "ionic:build" "--prod"
18 verbose node v6.11.4
19 verbose npm  v5.4.2
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] ionic:build: `ionic-app-scripts build`
22 error Exit status 1
23 error Failed at the [email protected] ionic:build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Which @ionic/app-scripts version are you using?

ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

local packages:

    @ionic/app-scripts : 3.0.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    Node : v6.11.4
    npm  : 5.4.2 
    OS   : macOS Sierra

Misc:

    backend : legacy

Maybe related issue:
#1199 (Postproccess tries to move .map files on --prod builds)

@mwiley63
Copy link

mwiley63 commented Oct 18, 2017

Try upgrading your ionic cli. I repeated the same steps with 13.1 and --prod builds worked.

My ionic info:


cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.1

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.7.1

System:

    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    Node       : v7.4.0
    npm        : 4.0.5 
    OS         : macOS Sierra
    Xcode      : Xcode 9.0 Build version 9A235 

This may not be related to #1199 as it references app-scripts 2.4.1

@big-r81
Copy link
Author

big-r81 commented Oct 18, 2017

Upgraded my global packages to the latest version:

npm -g update

Started a new blank project with the same steps i mentioned above and getting the same error.

My ionic info:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.1

local packages:

    @ionic/app-scripts : 3.0.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    Node : v6.11.4
    npm  : 5.5.1 
    OS   : macOS Sierra

Misc:

    backend : legacy

I'm getting the same error:

> [email protected] ionic:build /Users/big-r/Documents/Developer/prod
> ionic-app-scripts build

[10:03:13]  ionic-app-scripts 3.0.0 
[10:03:13]  build prod started ... 
[10:03:13]  clean started ... 
[10:03:13]  clean finished in 1 ms 
[10:03:13]  copy started ... 
[10:03:13]  deeplinks started ... 
[10:03:13]  deeplinks finished in 29 ms 
[10:03:13]  ngc started ... 
[10:03:21]  ngc finished in 7.92 s 
[10:03:21]  preprocess started ... 
[10:03:21]  copy finished in 8.02 s 
[10:03:21]  preprocess finished in 116 ms 
[10:03:21]  webpack started ... 
[10:03:49]  webpack finished in 28.42 s 
[10:03:49]  uglifyjs started ... 
[10:03:49]  sass started ... 
[10:03:51]  sass finished in 1.69 s 
[10:03:51]  cleancss started ... 
[10:04:02]  cleancss finished in 10.49 s 
[10:04:06]  uglifyjs finished in 16.17 s 
[10:04:06]  postprocess started ... 
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/Users/big-r/Documents/Developer/prod/www/build/main.js.map'
    at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] ionic:build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/big-r/.npm/_logs/2017-10-18T08_04_06_111Z-debug.log

Logfile (2017-10-18T08_04_06_111Z-debug.log):

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node@6/6.11.4_1/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'ionic:build',
1 verbose cli   '--prod' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preionic:build', 'ionic:build', 'postionic:build' ]
5 info lifecycle [email protected]~preionic:build: [email protected]
6 info lifecycle [email protected]~ionic:build: [email protected]
7 verbose lifecycle [email protected]~ionic:build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~ionic:build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/big-r/Documents/Developer/prod/node_modules/.bin:/usr/local/opt/node@6/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
9 verbose lifecycle [email protected]~ionic:build: CWD: /Users/big-r/Documents/Developer/prod
10 silly lifecycle [email protected]~ionic:build: Args: [ '-c', 'ionic-app-scripts build' ]
11 silly lifecycle [email protected]~ionic:build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~ionic:build: Failed to exec ionic:build script
13 verbose stack Error: [email protected] ionic:build: `ionic-app-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:920:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/big-r/Documents/Developer/prod
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node@6/6.11.4_1/bin/node" "/usr/local/bin/npm" "run" "ionic:build" "--prod"
18 verbose node v6.11.4
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] ionic:build: `ionic-app-scripts build`
22 error Exit status 1
23 error Failed at the [email protected] ionic:build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.

@killerchip
Copy link

It must be something with your environment (but I really don't know what).
I'm looking into it myself.

I have the exact same behavior as mentioned here:
#1235

But my build works in my Windows 10 laptop.

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

3 participants