Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install fails because package is missing in registry

I have an issue with a project where we are using node and brunch. The issue is current specific to brunch, but could occur for any module would be my guess.

The easiest way to currently reproduce this, is to do the following in a new folder:

npm init
npm install --save-dev brunch

The issue here is that brunch depends on loggy, which in turn depends on ansi-color, which no longer has an entry in the npmregistry:

https://registry.npmjs.org/ansi-color

I think this might be the github project: https://github.com/loopj/commonjs-ansi-color

In any case, I am unable to proceed, and all our builds fail because they are not able to fetch the given dependency.

I could perhaps use npm shrinkwrap in some way, but that depends on the modules already existing in node_modules, which I am currently missing.

So how can I force npm to use ansi-color from a different location, or ignore the dependency?

like image 932
Staale Avatar asked Aug 05 '15 07:08

Staale


1 Answers

Not sure about npm 2 but you can fix this with beta npm 3. npm 3 has flat node_modules directory. So sub modules can sit in the top level. Read the Changelog.

The missing modules can be installed directly from their Github repo as a toplevel dependency in your project. If npm finds the module with the same version in node_modules directory, it won't look for it anymore in the registry.

Install npm 3:

npm install -g npm@3-latest 

Then install depencies:

//install missing module from other location
npm install  https://github.com/loopj/commonjs-ansi-color.git --save-dev
npm install --save-dev brunch
like image 98
hassansin Avatar answered Oct 14 '22 00:10

hassansin