Grunt on Windows 8: 'grunt' is not recognized

前端 未结 11 1985
刺人心
刺人心 2020-11-29 01:07

I\'m having a problem running Grunt from the command line on my Windows 8 machine.

My research indicates the most common solution is to install grunt-cli, since Gru

相关标签:
11条回答
  • 2020-11-29 01:24

    If you have no grunt.cmd file created by npm, make sure that you do not have a .npmrc in your home directory with: bin-links=false in it.

    0 讨论(0)
  • 2020-11-29 01:26

    Confirm your PATH is correct (and not messed up). Just type PATH from the command prompt. There's really no other explanation that makes sense given the error you're describing and the steps you've taken.

    Normally, using the where grunt command would have found grunt.cmd in your path if npm is installed correctly and it has been properly added to the system path.

    0 讨论(0)
  • 2020-11-29 01:28

    I was facing the same problem on windows 8

    I have added ' %APPDATA%\npm ' to the path variable . It has been working fine.

    0 讨论(0)
  • 2020-11-29 01:29

    I know this has been answered but I thought I'd offer my step by step solution for windows 8.

    First thing I checked was the PATH in my laptops Environment Variables (Right click my computer > properties > advanced system settings > Environment Variables)

    It wasn't listed in there so I added a new variable in User variables (so it was specific only to my user account)

    In the new user variable prompt I entered the following;

    Variable Name: PATH
    
    Variable Value: %USERPROFILE%\AppData\Roaming\npm
    

    Quit command prompt, repoened, navigated to my projects directory and tried running grunt again and... SUCCESS!

    0 讨论(0)
  • 2020-11-29 01:34

    I have stucked with problem on Windows 8, that after install grunt-cli I've always got "command not found" while I'm tried to check grunt -v or where grunt. So I've added to enviroment PATH this path C:\Program Files (x86)\Git\local and run grunt.cmd from that folder (you need to look in node_modules folder here). And after reloading my terminal everything started to work.

    0 讨论(0)
  • 2020-11-29 01:36

    Same happened to me and here was the solution: Have you got 2 different versions of Node.JS installed? Maybe Nodist? This means you likely got NPM installed twice which will install the commands into 2 different folders: Once into C:\Users\<user>\AppData\Roaming\npm and once into C:\dev\nodist\bin\bin.

    C:\dev\nodist\bin\bin wasn't on my path variable so I added it, and I removed the Node.JS version I didn't want to use.

    0 讨论(0)
提交回复
热议问题