Npm install WARN unmet dependency

Experience issues installing NPM in the sage theme directory. I’ve completed over 20 installs of Roots and Bedrock + Sage and have never run into this. Does anyone have any ideas on what the issue is here?

    user@host:/var/www/bedrock/web/app/themes/sage$ npm install
    npm WARN unmet dependency /var/www/bedrock/web/app/themes/sage/node_modules/asset-builder/node_modules/main-bower-files requires minimatch@'^1.0.0' but will load

… (and the list continued).

Tried moving the node_modules directory and running “npm install”. The result was “Process Killed” after waiting about 15 minutes. Check the node_modules directory and some modules are there, but it seems incomplete. Any recommendations?

  user@host:/var/www/bedrock/web/app/themes/sage$ npm install
    Killed
    user@host:/var/www/bedrock/web/app/themes/sage$ npm install
    npm WARN unmet dependency /var/www/bedrock/web/app/themes/sage/node_modules/asset-builder/node_modules/main-bower-files requires minimatch@'^1.0.0' but will load
    npm WARN unmet dependency 

This isn’t an issue with Sage, this is an issue with your environment.

Googling your error brings up lots of results. What have you tried besides removing the node_modules directory, and have you tried that multiple times?

This isn’t the appropriate place for Node support. Stack Overflow is better suited for these types of questions.

I’ve just got this issue too…

Same situation as Michael - we’ve deployed a ton of Roots/Sage sites in the past, and this is only just happening… I work on a Sage site of some sort every single day, and the first one I provision today this happened.

I’ve now (probably) made the problem worse by trying to fix…

Will keep you posted.

OK, I have fixed it, although I have no idea why it suddenly happened… I (as I’m sure is the case with many devs) haven’t shut my macbook down in a week or so, I just close the lid… I was working absolutely fine on a Sage 8.1 site yesterday, and nothing has changed on my laptop… so why it would get screwy today (on the same day as you) after working perfectly for 18 months, through the ages and ascension of Roots & Sage… I have no idea…

I only actually found this thread thru Googling for the problem.

So, I did a little bit of this:

https://docs.npmjs.com/getting-started/fixing-npm-permissions

(option 2 specifically)

Then a little bit of that:

sudo npm cache clean -f clear you npm cache
sudo npm install -g n install "n" (this might take a while)
sudo n stable upgrade to lastest version

And finally chucked a bit of this on top:

npm cache clean
rm -rf node_modules/
npm install

And hey presto…

Didn’t do, but was next thing on the list:
curl -L https://www.npmjs.org/install.sh | sh

All was done from current theme directory. Hope it works for you too Michael.

1 Like

FWIW, we have these exact instructions on the sticky thread Iinked

@ben Sorry for posting an environment issue. For what it’s worth the feedback from you and Doug was very helpful, and ultimately lead me to resolving the issue.

@doug Good call on the $sudo npm install -g n, $sudo n stable. I basically just started fresh, installing node and npm according to the nodesource guidelines for Ubuntu.

One key issue to note is even after performing a strict install of node and npm, I still ran into problems with ‘npm install’ and ‘gulp’ commands in the theme directory. After running ‘npm install’ in the theme directory, I was returned with a thow err, as some dependencies were missing. I resolved the error by manually installing the missing dependency which in this case was browser-sync. I’ve posted more detailed instructions on TutorialShares. In case anyone reading this is running into the same issue with their install on Ubuntu, here’s what I did.

Install a Node and a stable version of NPM

curl -sL https://deb.nodesource.com/setup_dev | sudo bash -
sudo apt-get install -y nodejs
apt-get install -y build-essential
sudo npm install -g n
sudo n stable

Fix NPM Permissions

mkdir ~/npm-global
npm config set prefix '~/npm-global'export PATH=~/npm-global/bin:$PATH
source ~/.profile
sudo npm cache clean

Install Bower and Gulp

sudo npm install -g gulp bower

Install NPM and Bower in the theme

cd /var/www/bedrock/web/app/themes/sage
npm install
bower install

Finishing Up

gulp
If you have a throw err, manually install the npm dependency
npm install --save-dev browser-sync
gulp

My preference on Ubuntu and OS X is to just use NVM.

As noted in the sticky: Npm Debugging Guidelines (Failed npm install, bower install, or gulp build? Read this)

Installing node to install a node version manager is very strange.

1 Like

Agreed, especially since NPM includes nodejs. I’m not happy with this method and look forward to correcting it, but at the end of that day, it got the job done.

In previous installs I could get away with a simple $ apt-get install npm. Then write a link to correct now the nodejs directory was named $ln -s /usr/bin/nodejs /usr/bin/node.

On my last couple of installs that method no longer seemed to work. I’ll try out NVM next time, but ultimately I’d like to have a formula for running this install consistently using NPM.

I’ll also try to wean myself off of apt-get and just install NPM directly like this:
$ curl -L https://npmjs.org/install.sh | sh

Always glad to hear feedback or tips, thanks @Austin!