'grunt' is not recognized as an internal or external command for some windows users

前端 未结 6 2088
囚心锁ツ
囚心锁ツ 2021-02-11 15:00

Grunt is not working for all Windows users. Some users are facing some issues, when I run npm install command; it prints a message as below.

E:\\Wor         


        
相关标签:
6条回答
  • 2021-02-11 15:03

    Grunt is no longer installed globally. See the Getting Started page for more information.

    The command below should help you fix this;

    npm install -g grunt-cli
    
    0 讨论(0)
  • 2021-02-11 15:08

    Grunt-CLI is installed inside %AppData%\npm, so the best directory to add to your %PATH% is:

    %AppData%\npm
    
    0 讨论(0)
  • 2021-02-11 15:10

    Incase that there some developer that used Windows XP, that have similar problem you'll need to change Path entry.

    From: C:\Users\change_username\AppData\Roaming\npm\grunt

    To: C:\Documents and Settings\change_username\Application Data\npm

    0 讨论(0)
  • 2021-02-11 15:14

    On Windows 8, Grunt needs to have the following added to the PATH:

    C:\Users\your_username\AppData\Roaming\npm
    

    On some systems, the number of characters allowable in the PATH is limited, and this can cause the correct path needed by grunt to not be added, even after npm install -g grunt-cli is run. Some settings (for example for certain programs you have installed) can be safely removed from the PATH, as they're generally there as a failsafe and often aren't required. If you have this issue:

    • Backup the variables in your PATH (This PC > right-click > Properties > Advanced system settings > Environment Variables > 'Edit' the 'Path' user variables for the current user, and copy the 'Variable value' and save it somewhere)
    • Remove some of the values from the PATH, and add in the path C:\Users\your_username\AppData\Roaming\npm

    Also, make sure that after installing the Grunt CLI and adding the path, that you close any open command windows and re-open them before trying a Grunt

    0 讨论(0)
  • 2021-02-11 15:17

    npm install grunt -g (or) npm install -g grunt-cli Please check your computer environmental variable path, it should contain the path of AppData. EX: E:\$APPDATA\npm\;

    MyComputer->Right click-> Properties ->Advances System Setting-> Environment Variables -> Path

    0 讨论(0)
  • 2021-02-11 15:24

    Your logs indicate that the grunt command was created in your global directory. The errors also indicate that C:\Users\mc862634\AppData\Roaming\npm\ is not in your path.

    You'll want to check your PATH and make sure that the \AppData\Roaming\npm location is added if it is missing.

    The easiest way to check is to open a command prompt and type PATH.

    See this other StackOverflow question as a reference: Grunt on Windows 8: 'grunt' is not recognized

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