Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple issues running grunt.cmd on windows

I had to modify grunt.cmd because the path for my system was very wrong:

Originally:

%~dp0\Application Data\npm\node_modules\grunt

Which would print:

\\dacwnas\Profiles\<user>\Application Data\npm\Application Data\npm\node_modules\grunt

Running grunt.cmd would throw a cannot find module error. Changing it to %~dp0\node_modules\grunt" removes the error.

But, running grunt.cmd --version in windows outputs nothing. It simply pauses for a moment and returns to a blank command line.

I'm running Windows 7 64-bit, and the command line is run as administrator

like image 978
Eric C Avatar asked Oct 08 '12 14:10

Eric C


People also ask

How do I install grunt on Windows?

The easiest way to add Grunt and gruntplugins to an existing package. json is with the command npm install <module> --save-dev . Not only will this install <module> locally, but it will automatically be added to the devDependencies section, using a tilde version range.

How do I download grunt from command line?

Installing the CLI. Run sudo npm install -g grunt-cli (Windows users should omit "sudo ", and may need to run the command-line with elevated privileges). The grunt command-line interface comes with a series of options. Use grunt -h from your terminal to show these options.


2 Answers

First, you should have the grunt-cli package installed globally:

npm install -g grunt-cli

Next, make sure you have grunt installed in your project folder.

You can do this by:

  • Making sure grunt is part of your package.json and run: npm install
  • Going to your project folder and just npm install grunt

After this, you shouldn't have any trouble running Grunt.

like image 180
alebelcor Avatar answered Nov 15 '22 09:11

alebelcor


Did you install grunt-cli?

My grunt.cmd content looks like that:

:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\node_modules\grunt-cli\bin\grunt" %*
) ELSE (
   node  "%~dp0\node_modules\grunt-cli\bin\grunt" %*
)
like image 44
lastboy Avatar answered Nov 15 '22 09:11

lastboy