简体   繁体   English

“grunt install”在Ubuntu上返回错误

[英]“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. 当我尝试在具有从NodeSource安装的最新nodejs的Ubuntu 14.04机器上运行“grunt install”时,我收到以下错误。

jit-grunt: Plugin for the "install" task not found. jit-grunt:未找到“安装”任务的插件。 If you have installed the plugin already, please setting the static mapping. 如果您已经安装了插件,请设置静态映射。 See https://github.com/shootaroo/jit-grunt#static-mappings 请参阅https://github.com/shootaroo/jit-grunt#static-mappings

Warning: Task "install" failed. 警告:任务“安装”失败。 Use --force to continue. 使用--force继续。

Aborted due to warnings. 因警告而中止。

Here is the part of Gruntfile.js related to jit-grunt: 以下是与jit-grunt相关的Gruntfile.js的一部分:

  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? 什么是grunt install任务? Can you please paste your package.json file here so we may see your dependencies? 你可以把你的package.json文件粘贴到这里,这样我们就可以看到你的依赖吗?

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 . jit-grunt输出该错误的原因是因为它无法找到名为grunt-contrib-installgrunt-installinstall的节点模块文件夹,其中包含一个带有JS文件的tasks/文件夹,用于注册名为install的Grunt任务。

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 如果是这样,你必须通过他们注册的任务名称给他们打电话: - https://www.npmjs.org/package/grunt-npm-install - grunt npm-install - https://www.npmjs.org/package/ grunt-auto-install - grunt 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. 对于grunt-auto-install软件包,您需要将其添加到jit-grunt的静态映射中,就像使用grunt-express-server和其他软件一样。


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 . 如果它不是上述内容,除了“也许你输入错误?”之外,我能提供的唯一其他答案类似于@ waqas-ahmed所做的假设:你的意思是从package.json文件中安装dependenciesdevDependencies ,也许你的意思是调用npm install ,而不是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. 这将把grunt命令放在你的系统路径中,允许它从任何目录运行。

Note that installing grunt-cli does not install the Grunt task runner! 请注意,安装grunt-cli不会安装Grunt任务运行器! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. Grunt CLI的工作很简单:运行已安装在Gruntfile旁边的Grunt版本。 This allows multiple versions of Grunt to be installed on the same machine simultaneously. 这允许多个版本的Grunt同时安装在同一台机器上。

 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. 将Grunt和gruntplugins添加到现有package.json的最简单方法是使用命令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. 这不仅会在本地安装,而且会使用波浪号版本范围自动添加到devDependencies部分。

for further assistance follow this link 如需进一步帮助,请点击此链接

http://gruntjs.com/getting-started http://gruntjs.com/getting-started

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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