简体   繁体   中英

“grunt install” returns error on Ubuntu

I get the following error when I try to run "grunt install" on a Ubuntu 14.04 box that has the latest nodejs installed from NodeSource.

jit-grunt: Plugin for the "install" task not found. If you have installed the plugin already, please setting the static mapping. See https://github.com/shootaroo/jit-grunt#static-mappings

Warning: Task "install" failed. Use --force to continue.

Aborted due to warnings.

Here is the part of Gruntfile.js related to jit-grunt:

  require('jit-grunt')(grunt, {
    express: 'grunt-express-server',
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn',
    protractor: 'grunt-protractor-runner',
    injector: 'grunt-asset-injector',
    buildcontrol: 'grunt-build-control'
  });

Can someone point to the right direction?

What is the grunt install task? Can you please paste your package.json file here so we may see your dependencies?

The reason jit-grunt is outputting that error is because it cannot find a node module folder named grunt-contrib-install , grunt-install , or install , with a tasks/ folder with JS files that register a Grunt task named install .

Do you mean either of these packages? If so, you have to call them via their registered task names: - https://www.npmjs.org/package/grunt-npm-installgrunt npm-install - https://www.npmjs.org/package/grunt-auto-installgrunt auto_install

For the grunt-auto-install package, you will need to add it to jit-grunt 's static mappings, like you have with grunt-express-server and others.


If it's not the above, apart from "maybe you mistyped?", the only other answer I can offer is similar to the assumption @waqas-ahmed made: that you mean to install dependencies and devDependencies from your package.json file, and that perhaps you mean to call npm install , not grunt install .

Try as below:

 1) npm install -g grunt-cli

This will put the grunt command in your system path, allowing it to be run from any directory.

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.

 2) npm install grunt --save-dev 

The easiest way to add Grunt and gruntplugins to an existing package.json is with the command npm install --save-dev. Not only will this install locally, but it will automatically be added to the devDependencies section, using a tilde version range.

for further assistance follow this link

http://gruntjs.com/getting-started

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