Grunt dependencies conflicts in Bootstrap

前端 未结 6 2072
滥情空心
滥情空心 2021-01-31 07:36

I\'ve downloaded Bootstrap source files from the official website and I\'m getting dependency conflicts when installing the project using node\'s npm. I have

相关标签:
6条回答
  • 2021-01-31 07:56

    You may have Grunt 0.4.3 installed globally but nothing installed locally.

    1. Run $ grunt --version to find which version you are on (not a necessary step).
    2. Create a package.json file 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"
          }
      }
      
    3. Run $ npm install while at the project's root folder.

    Done!

    --- UPDATE ---

    You could use Bower to install Bootstrap for you. It makes cumbersome installations a breeze. Bootstrap's Getting Started guide advises using it!

    $ bower install bootstrap
    

    Here is a blog post that might be relevant to you: Using Grunt + Bower with Laravel and Bootstrap

    Or you could always opt to let Grunt manage the installation of Bootstrap and maintain it as a dependency... There are several plugins out there that do the heavy-lifting.

    • https://www.google.com/search?q=github+grunt+bootstrap
    • https://www.npmjs.org/search?q=bootstrap
    • http://gruntjs.com/plugins + search for "bootstrap"
    0 讨论(0)
  • 2021-01-31 08:01

    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

    npm uninstall grunt
    

    Then I installed grunt 0.4.2

    npm install grunt@0.4.2
    

    This time, npm install worked just fine

    npm install
    
    0 讨论(0)
  • 2021-01-31 08:05

    I had this problem too.

    I installed bootstrap using git clone https://github.com/twbs/bootstrap.git and it worked fine from that resulting bootstrap directory.

    0 讨论(0)
  • 2021-01-31 08:05

    Try npm cache clean and then try install command again.

    0 讨论(0)
  • 2021-01-31 08:10

    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

    0 讨论(0)
  • 2021-01-31 08:13

    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":

    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 讨论(0)
提交回复
热议问题