'gulp' is not recognized as an internal or external command

后端 未结 11 1994
生来不讨喜
生来不讨喜 2021-02-03 17:03

I am trying to use Gulp and Node.Js to stream my process for minifying and concatenating CSS/JS files for production.

Here is what I have done.

  1. I installed
相关标签:
11条回答
  • 2021-02-03 17:30

    Go to My Computer>Properties>Advance System Settings>Environment Variables>

    Under the variables of Administrator edit the PATH variable & change its value to "C:\Users\Username\AppData\Roaming\npm". Note: The username in the path will be the current Admin user's name that you have logged in with.

    0 讨论(0)
  • 2021-02-03 17:33

    I solved the problem by uninstalling NodeJs and gulp then re-installing both again.

    To install gulp globally I executed the following command

    npm install -g gulp
    
    0 讨论(0)
  • 2021-02-03 17:34

    I was having the same exception with node v12.13.1,

    Downgraded node to v10.15.3 and it works fine now.

    0 讨论(0)
  • 2021-02-03 17:42

    Sorry that was a typo. You can either add node_modules to the end of your user's global path variable, or maybe check the permissions associated with that folder (node _modules). The error doesn't seem like the last case, but I've encountered problems similar to yours. I find the first solution enough for most cases. Just go to environment variables and add the path to node_modules to the last part of your user's path variable. Note I'm saying user and not system.

    Just add a semicolon to the end of the variable declaration and add the static path to your node_module folder. ( Ex c:\path\to\node_module)

    Alternatively you could:

    In your CMD

    PATH=%PATH%;C:\\path\to\node_module
    

    EDIT

    The last solution will work as long as you don't close your CMD. So, use the first solution for a permanent change.

    0 讨论(0)
  • 2021-02-03 17:42

    You need to make sure, when you run command (install npm -g gulp), it will create install gulp on C:\ directory.

    that directory should match with whatver npm path variable set in your java path.

    just run path from command prompt, and verify this. if not, change your java class path variable wherever you gulp is instaled.

    It should work.

    0 讨论(0)
  • 2021-02-03 17:43

    I had the same problem on windows 7. You must edit your path system variable manually.

    Go to START -> edit the system environment variables -> Environment variables -> in system part find variables "Path" -> edit -> add new path after ";" to your file gulp.cmd directory some like ';C:\Users\YOURUSERNAME\AppData\Roaming\npm' -> click ok and close these windows -> restart your CLI -> enjoy

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