npm install grunt fine, npm install --dev with grunt as devDependency results in warnings, errors

35 views
Skip to first unread message

Victor Roman

unread,
Jul 23, 2015, 3:13:49 PM7/23/15
to nodejs
When I run "npm install grunt", grunt installs into the local dir fine and within seconds.

If I have a package.json with grunt as a devDependency and run "npm install --dev" I see many warnings at first about other packages, which I assume grunt depends on.  Specifically, errors about packages being in both the dependencies and devDependencies list.  Eventually, I just start seeing tons of errors that say "attempt to lock file which hasn't been locked".

Why does "npm install grunt" work fine but "npm install --dev" have all these problems?  Is there a difference between the two?

package.json:

{
  "name": "myApp",
  "version": "0.0.0",
  "devDependencies": {
    "grunt": "^0.4.1"
  }
}


Aria Stewart

unread,
Jul 24, 2015, 8:41:13 AM7/24/15
to nodejs, vro...@solarcity.com, vro...@solarcity.com


On Thursday, July 23, 2015 at 3:13:49 PM UTC-4, Victor Roman wrote:
When I run "npm install grunt", grunt installs into the local dir fine and within seconds.

If I have a package.json with grunt as a devDependency and run "npm install --dev" I see many warnings at first about other packages, which I assume grunt depends on.  Specifically, errors about packages being in both the dependencies and devDependencies list.  Eventually, I just start seeing tons of errors that say "attempt to lock file which hasn't been locked".

Why does "npm install grunt" work fine but "npm install --dev" have all these problems?  Is there a difference between the two?


--dev
doesn't do what you think it does.

It flips an internal flag that does about 6 different things depending on context.

plain npm install will install all devDependencies of the root module, the one you run npm install in.

Its inversion of that behavior is npm install --production; in normal use, you'll never use --dev.

Out of curiosity, where'd you pick up the idea to run --dev?

Aria
 

Victor Roman

unread,
Jul 24, 2015, 7:13:58 PM7/24/15
to nodejs, ared...@nbtsc.org
Hi Aria,

Thank you for clarifying that for me.  At some point, I was running just "npm install" and it appeared that it was not installing the devDependencies.  That's when I went stalking the internet and came across this post: http://stackoverflow.com/questions/17374278/npm-install-not-pulling-in-devdependencies  I see now that I misinterpreted it.

"npm install" does install my devDependencies, so I'm back on track now, thanks!

-Victor
Reply all
Reply to author
Forward
0 new messages