简体   繁体   中英

Unable to find local grunt in my meanjs existing project on mac

I want to run the meanjs existing project that I got from my friend in my mac pc but when I run the 'grunt' command then following error is getting:

grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

after searching google I have used these two command below:

sudo npm install grunt --save-dev

npm install

but following errors are getting:

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

Aborted due to warnings.

[NB: but grunt is working for the newly created meanjs project on my local mac but not for this old project from my friend]

Updated - I have the the package.json file here:

{
  "name": "meanjsapp",
  "description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js",
  "version": "0.0.1",
  "engines": {
    "node": "0.10.x",
    "npm": "1.4.x"
  },
  "scripts": {
    "start": "grunt",
    "test": "grunt test",
    "postinstall": "bower install --config.interactive=false"
  },
  "dependencies": {
    "apn": "^1.7.4",
    "async": "~0.9.0",
    "body-parser": "~1.9.0",
    "bower": "~1.3.8",
    "chalk": "~0.5",
    "compression": "~1.2.0",
    "connect-flash": "~0.1.1",
    "connect-mongo": "~0.4.1",
    "consolidate": "~0.10.0",
    "cookie-parser": "~1.3.2",
    "cron": "^1.0.9",
    "express": "~4.10.1",
    "express-session": "~1.9.1",
    "forever": "~0.11.0",
    "glob": "~4.0.5",
    "grunt-cli": "~0.1.13",
    "helmet": "~0.5.0",
    "jsonwebtoken": "^5.0.2",
    "jwt-simple": "^0.3.0",
    "lodash": "~2.4.1",
    "method-override": "~2.3.0",
    "mongoose": "~3.8.8",
    "morgan": "~1.4.1",
    "multer": "^0.1.8",
    "nodemailer": "~1.3.0",
    "passport": "~0.2.0",
    "passport-facebook": "~1.0.2",
    "passport-github": "~0.1.5",
    "passport-google-oauth": "~0.1.5",
    "passport-linkedin": "~0.1.3",
    "passport-local": "~1.0.0",
    "passport-twitter": "~1.0.2",
    "swig": "~1.4.1"
  },
  "devDependencies": {
    "supertest": "~0.14.0",
    "should": "~4.1.0",
    "grunt-env": "~0.4.1",
    "grunt-node-inspector": "~0.1.3",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-contrib-jshint": "~0.10.0",
    "grunt-contrib-csslint": "^0.3.1",
    "grunt-ng-annotate": "~0.4.0",
    "grunt-contrib-uglify": "~0.6.0",
    "grunt-contrib-cssmin": "~0.10.0",
    "grunt-nodemon": "~0.3.0",
    "grunt-concurrent": "~1.0.0",
    "grunt-mocha-test": "~0.12.1",
    "grunt-karma": "~0.9.0",
    "load-grunt-tasks": "~1.0.0",
    "karma": "~0.12.0",
    "karma-jasmine": "~0.2.1",
    "karma-coverage": "~0.2.0",
    "karma-chrome-launcher": "~0.1.2",
    "karma-firefox-launcher": "~0.1.3",
    "karma-phantomjs-launcher": "~0.1.2"
  }
}

Can anybody help me?

A Node.js project, if used with npm , must come with a package.json file. The package.json ( https://docs.npmjs.com/files/package.json ) file contains all the infos about the project, even the dependencies (which are added with the --save ).

So if your friend did everything right you have just to run npm install and should install all the dependencies. If there's no package.json file or if there are no dependencies written on it, you have to install them manually.

grunt has many modules to work, and one of those is called load-grunt-tasks so you should run again npm install load-grunt-tasks --save-dev of course this is just if you do not have the dependencies in the file.

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