New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fails on windows (spawn issue) #15

Closed
jeromerg opened this Issue Mar 19, 2014 · 13 comments

Comments

Projects
None yet
9 participants
@jeromerg

jeromerg commented Mar 19, 2014

Hi,
I generated a new projet just following the generation steps provided on the main page of generator-ionic. The command 'grunt serve' works fine. But the next one 'grunt build' fails with the following error:


...
Running "cordova:build" task

c:\Data\Kai\panini\dev\stigga-stack\client3\node_modules\grunt-contrib- compass\node_modules\tmp\lib\tmp.js:261
throw err;
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)

at Process.ChildProcess._handle.onexit (child_process.js:779:34)

what did I wrong?

Thank you in advance for your help!

Jerome

@mhartington

This comment has been minimized.

Show comment
Hide comment
@mhartington

mhartington Mar 19, 2014

What version of node do you have installed? Try updating your installed gems, and running brew update. I had some issues like this on other generators and it always came back to something needed to be updated on my end

mhartington commented Mar 19, 2014

What version of node do you have installed? Try updating your installed gems, and running brew update. I had some issues like this on other generators and it always came back to something needed to be updated on my end

@Flow11

This comment has been minimized.

Show comment
Hide comment
@Flow11

Flow11 Mar 19, 2014

hi Jerome,

I'm not sure but i think it's related to the use of spawn, in the 'Gruntfile.js', on windows.
If you are on windows that might explain your problem.
Here the issue related to the problem on the node project: nodejs/node-v0.x-archive#2318
The issue is still opened though.

A solution would be to replace spawn by win-spawn:

  1. npm install win-spawn
  2. Replace the line in the Gruntfile.js:
    var spawn = require('child_process').spawn;
    by
    var spawn = require('win-spawn');

Flow11 commented Mar 19, 2014

hi Jerome,

I'm not sure but i think it's related to the use of spawn, in the 'Gruntfile.js', on windows.
If you are on windows that might explain your problem.
Here the issue related to the problem on the node project: nodejs/node-v0.x-archive#2318
The issue is still opened though.

A solution would be to replace spawn by win-spawn:

  1. npm install win-spawn
  2. Replace the line in the Gruntfile.js:
    var spawn = require('child_process').spawn;
    by
    var spawn = require('win-spawn');
@diegonetto

This comment has been minimized.

Show comment
Hide comment
@diegonetto

diegonetto Mar 20, 2014

Owner

Jerome,

Can you give us some more information about what operating system you're on and what version of Node.js you're using?

I was unable to reproduce this issue, so if the above mentioned suggestions haven't resolved your problem, please let us know! Thanks.

Owner

diegonetto commented Mar 20, 2014

Jerome,

Can you give us some more information about what operating system you're on and what version of Node.js you're using?

I was unable to reproduce this issue, so if the above mentioned suggestions haven't resolved your problem, please let us know! Thanks.

@jeromerg

This comment has been minimized.

Show comment
Hide comment
@jeromerg

jeromerg Mar 20, 2014

Issue was fixed with Flow11's tip:
var spawn = require('win-spawn');

I develop on windows 7 PC and node.js version is v0.10.25.

Thank you for the quick reply!

Jerome

jeromerg commented Mar 20, 2014

Issue was fixed with Flow11's tip:
var spawn = require('win-spawn');

I develop on windows 7 PC and node.js version is v0.10.25.

Thank you for the quick reply!

Jerome

@jeromerg jeromerg closed this Mar 20, 2014

@diegonetto

This comment has been minimized.

Show comment
Hide comment
@diegonetto

diegonetto Mar 21, 2014

Owner

Re-opening this for now. I used spawn instead of exec because I wanted to stream the output of the Cordova commands, but it would be a good idea rewrite this in a way that is more portable.

Owner

diegonetto commented Mar 21, 2014

Re-opening this for now. I used spawn instead of exec because I wanted to stream the output of the Cordova commands, but it would be a good idea rewrite this in a way that is more portable.

@diegonetto diegonetto reopened this Mar 21, 2014

@diegonetto diegonetto changed the title from build fails to build fails on windows Mar 21, 2014

@diegonetto diegonetto changed the title from build fails on windows to build fails on windows (spawn issue) Mar 21, 2014

@diegonetto diegonetto added the bug label Mar 21, 2014

@diegonetto

This comment has been minimized.

Show comment
Hide comment
@diegonetto

diegonetto Mar 23, 2014

Owner

Looks like the root cause of this issue is that the main cordova command for Windows is a .cmd file and since spawn does not execute in a shell, only .exe files would run.

Great gist - https://gist.github.com/domenic/2790533#non-portable-apis

Even the official npm command has to incorporate some branching logic - https://github.com/npm/npm-www/blob/fd3a96e861989338676937736599598f7c0fde8f/dev/go.js#L22-27

I should have a fix for this shortly.

Owner

diegonetto commented Mar 23, 2014

Looks like the root cause of this issue is that the main cordova command for Windows is a .cmd file and since spawn does not execute in a shell, only .exe files would run.

Great gist - https://gist.github.com/domenic/2790533#non-portable-apis

Even the official npm command has to incorporate some branching logic - https://github.com/npm/npm-www/blob/fd3a96e861989338676937736599598f7c0fde8f/dev/go.js#L22-27

I should have a fix for this shortly.

@pgruenbacher

This comment has been minimized.

Show comment
Hide comment
@pgruenbacher

pgruenbacher Aug 31, 2014

I just got the exact same error even with the branch logic using the grunt build command. I'm using the win-spawn for now and it works

pgruenbacher commented Aug 31, 2014

I just got the exact same error even with the branch logic using the grunt build command. I'm using the win-spawn for now and it works

@diegonetto diegonetto reopened this Aug 31, 2014

@diegonetto

This comment has been minimized.

Show comment
Hide comment
@diegonetto

diegonetto Sep 7, 2014

Owner

@pgruenbacher are you still experiencing this issue on the latest version of generator-ionic ?

Owner

diegonetto commented Sep 7, 2014

@pgruenbacher are you still experiencing this issue on the latest version of generator-ionic ?

@pgruenbacher

This comment has been minimized.

Show comment
Hide comment
@pgruenbacher

pgruenbacher Sep 8, 2014

@diegonetto just did a clean install, and grunt build returned no errors. looks good.

pgruenbacher commented Sep 8, 2014

@diegonetto just did a clean install, and grunt build returned no errors. looks good.

@diegonetto diegonetto closed this Sep 8, 2014

@denisazevedo

This comment has been minimized.

Show comment
Hide comment
@denisazevedo

denisazevedo Oct 11, 2014

Just an update, this issue still happens on Windows machines (Win7 for example) with all npm packages updated (including generator-ionic@0.6.0).
Maybe a wiki page here could help new users. Thanks

denisazevedo commented Oct 11, 2014

Just an update, this issue still happens on Windows machines (Win7 for example) with all npm packages updated (including generator-ionic@0.6.0).
Maybe a wiki page here could help new users. Thanks

@djett41

This comment has been minimized.

Show comment
Hide comment
@djett41

djett41 Nov 6, 2014

You can modify the spawn variable at the top of the Gruntfile to the follwing:
var spawn = process.platform === 'win32' ? require('win-spawn') : require('child_process').spawn;

This has a dependency on the win-spawn plugin which will need to be added to your package.json and installed.

djett41 commented Nov 6, 2014

You can modify the spawn variable at the top of the Gruntfile to the follwing:
var spawn = process.platform === 'win32' ? require('win-spawn') : require('child_process').spawn;

This has a dependency on the win-spawn plugin which will need to be added to your package.json and installed.

@sriram-dev

This comment has been minimized.

Show comment
Hide comment
@sriram-dev

sriram-dev Nov 26, 2014

@djett41 That worked .. Thanks !

sriram-dev commented Nov 26, 2014

@djett41 That worked .. Thanks !

@irangausl

This comment has been minimized.

Show comment
Hide comment
@irangausl

irangausl Feb 5, 2015

Flow, Thank you very much. It worked for me.

irangausl commented Feb 5, 2015

Flow, Thank you very much. It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment