Eric C
Eric C

Reputation: 981

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

Upvotes: 7

Views: 4847

Answers (2)

alebelcor
alebelcor

Reputation: 363

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.

Upvotes: 2

lastboy
lastboy

Reputation: 576

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" %*
)

Upvotes: 1

Related Questions