ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 302 forks source link

Segmentation fault on ionic serve #955

Open rmgpinto opened 7 years ago

rmgpinto commented 7 years ago

Short description of the problem:

I get a segmentation fault on ionic serve.

What behavior are you expecting?

ionic serve to finish.

Steps to reproduce:

  1. npm install -g cordova ionic@beta
  2. ionic start newapp sidemenu --no-cordova
  3. cd newapp
  4. ionic serve
> ionic-app-scripts build

[18:58:33]  ionic-app-scripts 1.3.6 
[18:58:33]  build dev started ... 
[18:58:33]  clean started ... 
[18:58:33]  clean finished in 4 ms 
[18:58:33]  copy started ... 
[18:58:33]  transpile started ... 
[18:58:36]  transpile finished in 3.21 s 
[18:58:36]  preprocess started ... 
[18:58:36]  deeplinks started ... 
[18:58:36]  deeplinks finished in 19 ms 
[18:58:36]  preprocess finished in 21 ms 
[18:58:36]  webpack started ... 
[18:58:37]  copy finished in 3.60 s 
[18:58:47]  webpack finished in 10.74 s 
[18:58:47]  sass started ... 
Segmentation fault

npm ERR! Linux 4.9.13-moby
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v7.2.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! webapp@0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 139
npm ERR! 
npm ERR! Failed at the webapp@0.0.1 build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the webapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs webapp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls webapp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /webapp/npm-debug.log

npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm@3.10.10
3 info using node@v7.2.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle webapp@0.0.1~prebuild: webapp@0.0.1
6 silly lifecycle webapp@0.0.1~prebuild: no script for prebuild, continuing
7 info lifecycle webapp@0.0.1~build: webapp@0.0.1
8 verbose lifecycle webapp@0.0.1~build: unsafe-perm in lifecycle true
9 verbose lifecycle webapp@0.0.1~build: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/webapp/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle webapp@0.0.1~build: CWD: /webapp
11 silly lifecycle webapp@0.0.1~build: Args: [ '-c', 'ionic-app-scripts build' ]
12 silly lifecycle webapp@0.0.1~build: Returned: code: 139  signal: null
13 info lifecycle webapp@0.0.1~build: Failed to exec build script
14 verbose stack Error: webapp@0.0.1 build: `ionic-app-scripts build`
14 verbose stack Exit status 139
14 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:885:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid webapp@0.0.1
16 verbose cwd /webapp
17 error Linux 4.9.13-moby
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
19 error node v7.2.1
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error webapp@0.0.1 build: `ionic-app-scripts build`
22 error Exit status 139
23 error Failed at the webapp@0.0.1 build script 'ionic-app-scripts build'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the webapp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     ionic-app-scripts build
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs webapp
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls webapp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

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

sebinbenjamin commented 7 years ago

I have the same issue running ionic build browser after installing ionic, cordova package in docker image of node:boron-alpine.

chearius commented 7 years ago

I found the source of the problem with building / serving Ionic Apps on Alpine Linux. The problem is in the recursive usage of the function str-replace in ionic-angular/themes/ionic.functions.scss. On Alpine, it generates segmentation fault after reaching a recursion depth of about 10 (at least on my systems).

There is an (closed) issue at libsass https://github.com/sass/libsass/issues/1823 that describes this phenomenon. There are also two alternative implementations of str-replace that seem to work.

After patching the file ionic.functions.scss, I can build Ionic apps on Alpine Linux without any problems.

Since the current implementation of str-replace in Ionic would lead to similar problem on other platforms (im there are enough spaces in the inline svg), I suggest that the problem should be fixed within the Ionic Framework.

carstenbaumhoegger commented 7 years ago

I'm also running into this problem when trying to test my app inside an Alpine Linux container. Any status update on this?

gunvant commented 6 years ago

Hi.. any update on this??.. I am facing same issue. Please find below configuration details.

Os : Redhat Linux Ionic : 3.18.0 ionic-app-scripts: 3.0.0