Error: Cannot find module "time-grunt"

I created everything for the project with the following commands:

 sudo npm install -g grunt-cli
 sudo npm install grunt --save-dev
 sudo npm install grunt-contrib-jshint --save-dev
 sudo npm install jshint-stylish --save-dev
 sudo npm install time-grunt --save-dev
 sudo npm install jit-grunt --save-dev

And this is my package.json file

 {
    "name": "Project1",
    "private": true,
    "devDependencies": {
       "grunt": "^0.4.5",
       "grunt-contrib-jshint": "^0.12.0",
       "jit-grunt": "^0.9.1",
       "jshint-stylish": "^2.1.0",
       "time-grunt": "^1.3.0"
   },
    "engines": {
      "node": ">=0.10.0"
     }
   }

When I run the grunt command, it gives the following errors:

    Loading "Gruntfile.js" tasks...ERROR
    >> Error: Cannot find module 'time-grunt'
    Warning: Task "default" not found. Use --force to continue.

    Aborted due to warnings.
+4
source share
1 answer

You need to add the internal time-grunt dependencies, not devDependencies. This way you do not need to run $ npm install --save-dev time-grunt separately

{
  "name": "grunt-build",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "time-grunt": "^1.3.0"
  },
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-clean": "~0.7.0",
    "grunt-contrib-compress": "~0.5.0",

  }
}
+1
source

Source: https://habr.com/ru/post/1625656/


All Articles