New Grunt user here who is using a lot of new tools (npm nodejs) today.
I\'ve got Grunt \"installed\" and have been able to create a grunt.js file using the init tas
SOLVED !!
So, this problem occur because windows by default associative < *.js > files with >> "Microsoft Windows Based Script Host".
grunt need to open by default with (grunt.cmd).
it easy to slove, by change default app (open with..)
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any javascript IDE ).
PROBLEM SOLVED ! :) good luck
To answer this, first we need to understand that the error is caused because it is being executed by Windows Script Host.
Now, run the code from your cmd promt with the following syntax:
>node <application_name>.js
this will allow the Node.js application to open through V8 JavaScript engine(Google's).
P.S: Please reply back if this has helped in resolving your issue else post the problem you are facing after trying this.
I went through the same issue when running an old Node project.
The issue was with the name of the js file, it was node.js
. So the while running the command node node.js
, it was opening up a windows dialogue box.
I just changed the name of the file to app.js
and the error flew away.
So, in my case i had tryed all the mentioned above with no result.
But i have fund that im dont type: node in the full sentence as the following snipet
node script.js
.And remember never understimate your own miscoding.
As Florian F suggested, running grunt.cmd works. This is because of the process Windows is looking for your grunt
command.
When typing grunt -h
Windows will proceed to look for the following files:
An alternative to using "grunt.cmd" is to use grunter which simply renames the command to grunter... then you no longer have this problem.
it seems that in the latest versions of the grunt modules, you would have to do the following to have it work under windows:
remove any globally installed grunt
npm uninstall -g grunt
install grunt-cli globally
npm install -g grunt-cli
install grunt locally into your project
npm install grunt
installing grunt (v0.4.x) globally does not seem to create the necessary grunt.cmd anymore. it seems that the recommendation is now to have grunt installed locally to be able to use version-specific Gruntfiles