Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package.json isn't installing dependencies when running npm install

Tags:

node.js

npm

I've created a package.json file for my private app. In it, I have my dependencies listed, as expected. Some of those dependencies have dependencies of their own. When running npm install on my app, it's not installing the dependencies of my dependencies. Is there something wrong with my package.json file which is preventing this? ("winston" is one of my dependencies which isn't properly installing)

{  
  "name": "my app",  
  "version": "0.0.1",  
  "dependencies" : {  
    "connect" : "1.8.5",  
    "express" : "2.5.8",  
    "socket.io" : "0.8.7",  
    "winston" : "0.5.9"
  },  
  "engine": {  
    "node": ">=0.6"  
  }  
}

Reponse to comments: NPM installs the top level deps, fine, no errors, it looks like it works. It just never downloads the deps of the deps. Will try the -d option.

like image 686
marcc Avatar asked Mar 13 '12 04:03

marcc


People also ask

How do I force npm to install dependencies?

Install the dependencies to the local node_modules folder. In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package. By default, npm install will install all modules listed as dependencies in package.

How do I fix npm dependency issues?

The easiest way to fix the issue is to pass an additional parameter –legacy-peer-deps to npm install. The --legacy-peer-deps tells the npm to ignore the peer dependencies and continue the installation of the package.

Does npm install add to package json?

When you (or another user) run npm install , npm will download dependencies and devDependencies that are listed in package. json that meet the semantic version requirements listed for each.

Does npm install automatically install dependencies?

Development and Production Dependencies We can also have dependencies that are used for both development and production. When we install a package with npm, it's automatically added as a general dependency, which is for both dev and production.


1 Answers

Spaces are not allowed in the name option for package.json files.

The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can't contain any non-URL-safe characters.

https://docs.npmjs.com/files/package.json#name

like image 189
Samuel Avatar answered Sep 20 '22 19:09

Samuel