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

Missing node in spawn command on windows #9

Open
Bartvds opened this issue Apr 9, 2014 · 21 comments
Open

Missing node in spawn command on windows #9

Bartvds opened this issue Apr 9, 2014 · 21 comments

Comments

@Bartvds
Copy link

Bartvds commented Apr 9, 2014

When I use this plugin I get this error:

error: Something went wrong with the action
error: An error occured:
Error: spawn ENOENT
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)

So I looked into the code, and this line needs a 'node' command to work (as the shebang does nothing on windows):

command = [@path.join rootPath, gruntPath]

https://github.com/RobLoach/docpad-plugin-grunt/blob/master/src/grunt.plugin.coffee#L52

Then it works as expected.

(well, small detail: it needs an extra newline: the 'Running "xyz" task' message gets appended to the progress bar's line:

FooPerforming generate: generateBefore at 5/10 50% ========================-------------------------Running "echo" task
echo!

Done, without errors.
@paulradzkov
Copy link
Contributor

I have same error. I was trying to change this line to «command = 'node ./' + [@path.join rootPath, gruntPath]» — error message disappears, all tests passed, but actually no grunt task ran in docpad.

@Bartvds, how did you fix that? Can you make pull-request?

@Bartvds
Copy link
Author

Bartvds commented Jul 16, 2014

@InterPaul I never solved it, instead I used another pattern: instead of calling grunt from docpad I run docpad from grunt, is a lot more convenient.

@paulradzkov
Copy link
Contributor

Thanks @Bartvds, I'll try the same way

@paulradzkov
Copy link
Contributor

Instead

command = [@path.join rootPath, gruntPath]

should be

command = ['node', @path.join rootPath, gruntPath]

@paulradzkov
Copy link
Contributor

@RobLoach, This fix #12 makes version 2.1.1 (from npm) working. But version 2.1.2 from master branch still not working (for some other reasons)

@RobLoach
Copy link
Owner

@InterPaul Thanks for the pull request 👍 . Merged. Working now?

@paulradzkov
Copy link
Contributor

@RobLoach No, with docpad install grunt installed version 2.1.1 without fix.

@paulradzkov
Copy link
Contributor

@RobLoach any updates?

@RobLoach
Copy link
Owner

@InterPaul Passing on Linux, where does it break on Windows?

@paulradzkov
Copy link
Contributor

See the original problem and the fix for version 2.1.1:

docpad-grunt-fix

This bug reproduces on Windows only.

I will retest v.2.1.2 on Windows and let you know.

@paulradzkov
Copy link
Contributor

Compiled plugin from your current master branch and checked it on my repository. There is no more error but no grunt task was executed.

See also cake test:

docpad-grunt-2-1-2-tests

Update:
v.2.1.2 cake test on Mac also reports that everything passed, but actually grunt task wasn't executed.
v.2.1.1 works fine on Mac.

Hope that helps.

@paulradzkov
Copy link
Contributor

Plugin still not working on Windows

@paulradzkov
Copy link
Contributor

I use own working build.
In package.json:

"docpad-plugin-grunt": "git://github.com/interpaul/docpad-plugin-grunt.git#v211compiled"

@RobLoach
Copy link
Owner

Hmm, interesting....

master...interpaul:v211

But when you see https://github.com/RobLoach/docpad-plugin-grunt/blob/master/src/grunt.plugin.coffee#L55 , there is already the 'node' prefix. Know what's going on?

@paulradzkov
Copy link
Contributor

Actually no.
For me plugin stops working after 6cff6a7

@RobLoach
Copy link
Owner

@InterPaul Which version of node is it?

@paulradzkov
Copy link
Contributor

v0.12.7

@RobLoach
Copy link
Owner

Do the tests pass for you on Windows?

git clone git@github.com:RobLoach/docpad-plugin-grunt.git
cd docpad-plugin-grunt
npm i
node_modules/.bin/cake test

@paulradzkov
Copy link
Contributor

Test failed.

See movie:
docpad-grunt

Final output:

coffee compile:
C:\Program Files\nodejs\node.exe c:\GitHub\docpad-plugin-grunt\node_modules\.bin
\coffee -co out src
c:\GitHub\docpad-plugin-grunt\node_modules\.bin\coffee:2
basedir=`dirname "$0"`
        ^
SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

@RobLoach
Copy link
Owner

Thanks for posting these movies 👍 . Quite helpful in debugging. What software are you using for them?

Unexpected token ILLEGAL is an interesting one, since it is CoffeeScript. Where is basedir= represented? I can't find it in my source.

@paulradzkov
Copy link
Contributor

LICEcap for screen to gif. Works both on Windows and MacOS.

As for basedir — I don't know, I'm just designer.

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

No branches or pull requests

3 participants