Skip to content
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
Closed

build fails on windows (spawn issue) #15

jeromerg opened this issue Mar 19, 2014 · 13 comments
Labels

Comments

@jeromerg
Copy link

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
Copy link

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

@flagrede
Copy link

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
Copy link
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.

@jeromerg
Copy link
Author

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

@diegonetto
Copy link
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.

@diegonetto diegonetto reopened this Mar 21, 2014
@diegonetto diegonetto changed the title build fails build fails on windows Mar 21, 2014
@diegonetto diegonetto changed the title build fails on windows build fails on windows (spawn issue) Mar 21, 2014
@diegonetto diegonetto added the bug label Mar 21, 2014
@diegonetto
Copy link
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.

@pgruenbacher
Copy link

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
Copy link
Owner

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

@pgruenbacher
Copy link

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

@denisazevedo
Copy link

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
Copy link

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
Copy link

@djett41 That worked .. Thanks !

@irangausl
Copy link

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
Labels
Projects
None yet
Development

No branches or pull requests

9 participants