Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install doesn't install any dependencies

Tags:

node.js

I am trying to install packages in the package.json file. Unfortunately, when I run npm install, nothing happens (nothing is installed). I have used npm install on other repos and it works successfully.

Here is my path:

$PATH = /Users/me/.rbenv/shims:/Users/me/.rbenv/bin:/usr/local/share/npm/bin:/usr/local/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/bin:/bin:/usr/sbin:/sbin

As you can see, npm/bin is in my bath and I believe this is correct.

Here are the instructions for this repo and where to run npm install (which I am doing)

go into "module"
run "npm install"
pair your laptop/pc with intelligent brick troubleshoot: http://www.ev-3.net/en/archives/97
run example.js: "node example.js"
see "example.js" for more details

When I run npm install in the module directory (that has the package.json) nothing installs.

Here is the package.json:

{
  "name": "ev3-nodejs-bt",
  "description": "Bt Api for lego ev3 robot",
  "version": "0.0.4",
  "private": false,
  "dependencies": {
    "serialport": "1.*"
  },
  "main": "Ev3.js",
  "devDependencies": {"serialport": "1.*"},
  "scripts": {
    "test": "node Ev3.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/wenchaojiang/Ev3NodeJsBtAPI"
  },
  "keywords": [
    "node.js",
    "ev3",
    "lego",
    "robot",
    "bluetooth"
  ],
  "author": "Wenchao Jiang <[email protected]> (http://wenchaojames.wordpress.com/)",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/wenchaojiang/Ev3NodeJsBtAPI/issues"
  }
}

Do I have something set up wrong on my system? (I don't think I do based on my $PATH and successful installing packets in other node-js repos) Is this package.json file not valid?

like image 590
HelloWorld Avatar asked Apr 25 '14 20:04

HelloWorld


People also ask

Can't install dependencies npm?

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. Try the below command to install the dependencies for your project.

Will npm install install all dependencies?

By default, npm install will install all modules listed as dependencies in package.

Why is my npm install not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).


2 Answers

npm install doesn't install (or echo) anything when all of the dependencies are satisfied. Ensure there's a serialport folder under node_modules.

If you want to reinstall everything, you just need to remove the node_modules folder:

rm -r node_modules
npm install
like image 153
SomeKittens Avatar answered Oct 24 '22 04:10

SomeKittens


If you have an npm-shrinkwrap.json file, check it. The npm install command will only install the packages specified in that file.

According to the npm install docs:

If the package has a shrinkwrap file, the installation of dependencies will be driven by that.

I had the same problem with my project. And when I looked at my npm-shrinkwrap.json file, I saw dependencies: {}. So that's why it didn't install anything for me.

like image 22
Matthias Avatar answered Oct 24 '22 03:10

Matthias