twitter-bootstrap Bootstrap 中的 Grunt 依赖冲突
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22269101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Grunt dependencies conflicts in Bootstrap
提问by rpozarickij
I've downloaded Bootstrap source files from the official websiteand I'm getting dependency conflicts when installing the project using node's npm. I have grunt 0.4.3installed on my machine but some bootstrap dependencies require 0.4.0and some 0.4.1.
我已经从官方网站下载了 Bootstrap 源文件,在使用 node 的npm. 我已经grunt 0.4.3在我的机器上安装了一些引导程序依赖项,0.4.0而一些0.4.1.
The npm install -g grunt-clicommand executed without any problems. Here's the log that I'm getting after executing npm installcommand:
该npm install -g grunt-cli命令没有任何问题执行。这是我执行npm install命令后得到的日志:
npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.2
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants [email protected]
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd C:\Users\Desktop\bootstrap-3.1.1
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Desktop\bootstrap-3.1.1\npm-debug.log
npm ERR! not ok code 0
I'm following theseinstallation steps.
我正在遵循这些安装步骤。
How do I install this project cleanly, without any errors?
我如何干净地安装这个项目,没有任何错误?
回答by joeblubaugh
I ran into this problem this morning too. I ended up changing line 30 in Bootstrap's package.json file: from "~0.4.2" to "0.4.2":
我今天早上也遇到了这个问题。我最终将 Bootstrap 的 package.json 文件中的第 30 行从“~0.4.2”更改为“0.4.2”:
27 "devDependencies": {
...
30 "grunt" : "0.4.2"
This means that 0.4.3 no longer matches the dependency spec but it also means you won't install new versions of grunt later. It's enough to get things working but you should probably change it back eventually (maybe in your next bootstrap project leave it alone).
这意味着 0.4.3 不再与依赖项规范匹配,但也意味着您以后不会安装新版本的 grunt。这足以使事情正常工作,但您可能最终应该将其改回(也许在您的下一个引导项目中不要管它)。
回答by RobV8R
I encountered the same problem. Performing the following:
我遇到了同样的问题。执行以下操作:
bower install bootstrap
cd bower_components/bootstrap
npm install
Resulted in:
结果是:
npm ERR! peerinvalid The package grunt does not satisfy
its siblings' peerDependencies requirements!
I resolved this by first uninstalling grunt from the bootstrap directory
我通过首先从引导目录中卸载 grunt 解决了这个问题
npm uninstall grunt
Then I installed grunt 0.4.2
然后我安装了 grunt 0.4.2
npm install [email protected]
This time, npm installworked just fine
这一次,npm install工作得很好
npm install
回答by kazikai
this problem is peerDependencies for grunt
If you want to know this issue, then go to this url
http://blog.nodejs.org/2013/02/07/peer-dependencies/
this is solution to solve it's problem
step1 : You open the package.json in root directory
step2 : find the string "grunt" : "~0.4.2"
step3 : Modify to "grunt": "0.4.2"
step4 : $ npm install
这个问题是 grunt 的 peerDependencies
如果你想知道这个问题,那么去这个网址
http://blog.nodejs.org/2013/02/07/peer-dependencies/
这是解决它的问题的解决方案
step1:你打开根目录下的package.json
step2:找到字符串“grunt”:“~0.4.2”
step3:修改为“grunt”:“0.4.2”
step4:$ npm install
回答by jaydisc
I had this problem too.
我也有这个问题。
I installed bootstrap using git clone https://github.com/twbs/bootstrap.gitand it worked fine from that resulting bootstrap directory.
我安装了 bootstrap 使用git clone https://github.com/twbs/bootstrap.git,它在生成的 bootstrap 目录中运行良好。
回答by Shoaib Iqbal
Try npm cache cleanand then try install command again.
尝试npm cache clean然后再次尝试安装命令。
回答by Wallace Sidhrée
You may have Grunt 0.4.3installed globally but nothing installed locally.
您可能已Grunt 0.4.3全局安装,但未在本地安装任何内容。
- Run
$ grunt --versionto find which version you are on (not a necessary step). Create a
package.jsonfile in the root of the folder you mean to have your project on.{ "name" : "MyProject", "version" : "0.1.0", "author" : "My name", "private" : true, "devDependencies" : { "grunt" : "~0.4.2" } }Run
$ npm installwhile at the project's root folder.
- 运行
$ grunt --version以查找您使用的版本(不是必要步骤)。 package.json在您要放置项目的文件夹的根目录中创建一个文件。{ "name" : "MyProject", "version" : "0.1.0", "author" : "My name", "private" : true, "devDependencies" : { "grunt" : "~0.4.2" } }运行
$ npm install,同时在项目的根文件夹。
Done!
完毕!
--- UPDATE ---
- - 更新 - -
You could use Bowerto install Bootstrap for you. It makes cumbersome installations a breeze. Bootstrap's Getting Startedguide advises using it!
您可以使用Bower为您安装 Bootstrap。它使繁琐的安装变得轻而易举。Bootstrap 的入门指南建议使用它!
$ bower install bootstrap
Here is a blog post that might be relevant to you: Using Grunt + Bower with Laravel and Bootstrap
这是一篇可能与您相关的博客文章:在 Laravel 和 Bootstrap 中使用 Grunt + Bower
Or you could always opt to let Gruntmanage the installation of Bootstrapand maintain it as a dependency... There are several plugins out there that do the heavy-lifting.
或者,您始终可以选择让Grunt管理安装Bootstrap并将其作为依赖项进行维护......有几个插件可以完成繁重的工作。

