What is causing this error - “Fatal error: Unable to find local grunt”

前端 未结 13 653
夕颜
夕颜 2020-11-27 09:21

I removed the old version of grunt first, then I installed the new grunt version, and then I got this error:

D:\\www\\grunt-test\\grunt grunt-cli: The

13条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 09:32

    Could be a few problems here depending on what version of grunt is being used. Newer versions of grunt actually specify that you have a file named Gruntfile.js (instead of the old grunt.js).

    You should have the grunt-cli tool be installed globally (this is done via npm install -g grunt-cli). This allows you to actually run grunt commands from the command line.

    Secondly make sure you've installed grunt locally for your project. If you see your package.json doesn't have something like "grunt": "0.4.5" in it then you should do npm install grunt --save in your project directory.

提交回复
热议问题