“Fatal error: Unable to find local grunt.” when running “grunt” command

前端 未结 7 420
猫巷女王i
猫巷女王i 2021-01-30 08:11

I uninstalled grunt with following command.

npm uninstall -g grunt

Then I again installed grunt with following command.

npm ins         


        
7条回答
  •  抹茶落季
    2021-01-30 08:37

    All is explained quite nicely on gruntjs.com.

    Note that installing grunt-cli does not install the grunt task runner! The job of the grunt CLI is simple: run the version of grunt which has been installed next to a Gruntfile. This allows multiple versions of grunt to be installed on the same machine simultaneously.

    So in your project folder, you will need to install (preferably) the latest grunt version:

    npm install grunt --save-dev
    

    Option --save-dev will add grunt as a dev-dependency to your package.json. This makes it easy to reinstall dependencies.

提交回复
热议问题