简体   繁体   中英

Error: Cannot find module 'time-grunt'

I have set up everything for the project with 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 'grunt' command it gives 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.

You need to add "time-grunt" inside dependencies and not within devDependencies. This way you don't need to separately run $ npm install --save-dev time-grunt

{
  "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",

  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM