Multiple issues running grunt.cmd on windows

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

Originally:

%~dp0Application Datanpmnode_modulesgrunt

Which would print:

dacwnasProfiles<user>Application DatanpmApplication Datanpmnode_modulesgrunt

Running grunt.cmd would throw a cannot find module error. Changing it to %~dp0node_modulesgrunt" 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


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.


    Did you install grunt-cli?

    My grunt.cmd content looks like that:

    :: Created by npm, please don't edit manually.
    @IF EXIST "%~dp0node.exe" (
      "%~dp0node.exe"  "%~dp0node_modulesgrunt-clibingrunt" %*
    ) ELSE (
       node  "%~dp0node_modulesgrunt-clibingrunt" %*
    )
    
    链接地址: http://www.djcxy.com/p/11284.html

    上一篇: 强制Eclipse在每次运行之前自动清理项目

    下一篇: 在Windows上运行grunt.cmd有多个问题