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

Error: not found: node #236

Closed
olegccc opened this issue Apr 22, 2015 · 6 comments
Closed

Error: not found: node #236

olegccc opened this issue Apr 22, 2015 · 6 comments

Comments

@olegccc
Copy link

olegccc commented Apr 22, 2015

Windows:
when I execute grunt-ts from Maven using frontend-maven-plugin, it compiles typescript ok, but if I run it directly from grunt, I receive the error specified in the subject:

Running "ts:default" (ts) task
Compiling...
Using tsc v1.4.1
Error: not found: node

The problem is in compile.js file. If I change executeNode to the following code, everything starts to work:

function executeNode(args) {
    return new Promise(function (resolve, reject) {
        exports.grunt.util.spawn({
            cmd: 'cmd',
            args: ['/c node ' + args.join(" ")]
        }, function (error, result, code) {
            var ret = {
                code: code,
                // New TypeScript compiler uses stdout for user code errors. Old one used stderr.
                output: result.stdout || result.stderr
            };
            resolve(ret);
        });
    });
}
@basarat
Copy link
Member

basarat commented Apr 24, 2015

run it directly from grunt,

My Suspicion: This is because of $path inheritance. If the containing process's path doesn't have the path to node then the child process will not have it either. Starting a new cmd instance is fixing it.

Please answer the following:

  • Have you tried closing and reopeing the window where you are running grunt.
  • Also check if you can execute node in that window.

🌹

@olegccc
Copy link
Author

olegccc commented Apr 25, 2015

  • yes, I tried and it did not nelp. Actually I did many different things to try to understand.
  • yes it runs ok.

I have nodejs installed locally and accessible by path.
Frontend-maven-plugin downloads nodejs copy by itself and uses this copy instead of the installed one.
When I run grunt by myself, it uses nodejs installed on my computer, not the copy downloaded by the maven plugin.

The trick I did in the code above is from examples of how to use nodejs inside maven, like by this link:

http://addyosmani.com/blog/making-maven-grunt/

@nycdotnet
Copy link
Contributor

I suppose we could add a switch to allow "shelling out" to cmd as @olegccc has suggested works, but clearly we can't make this the default since it would affect our cross-platform story. I'll think about this. I'm glad you've got a workaround for now.

@RyanThomas73
Copy link
Contributor

I use local node instances in my boilerplates as well. I fixed this by changing cmd: 'node' to cmd: process.execPath

@nycdotnet
Copy link
Contributor

Ryan - thanks for submitting this. I will take a look this evening.

nycdotnet added a commit that referenced this issue May 7, 2015
Issues #236 - Fix for use of local node binaries.
nycdotnet added a commit that referenced this issue May 7, 2015
@nycdotnet
Copy link
Contributor

Should be fixed in #240 which will be a part of the next grunt-ts release.

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

4 participants