My AngularJS journey as brought me to the MEAN stack (MongoDB, Express, AngularJS, Node.js), and I now know enough Angular to be frustrated by the fact that I’m stuck with reading data I create in my js files, so I’m learning Node with the hopes of being able to actually build some sort of real and semi-useful application that can do something with a database.
I installed the current stable version of Node (4.2.4) and everything has been smooth sailing for the last couple of days. But I’m taking this Lynda course, and I came to the video on updating modules in Terminal, and naively followed the instructions to sudo update everything Node on my system to the latest version.
Rookie error. I typed the next command, and…
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:76:3)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
Now every single npm I type is greeted with the same grim message, over and over and over. I’ve been googling and trying solutions for the last 45 minutes, and I’m not totally sure if I should be nervous about the files I’m deleting.
Hey! A fix!! Super simple… I guess I should have tried this first. After deleting all the node files and folders I could find in
usr/local/lib/ and surrounding I just downloaded and installed the latest STABLE version from nodejs.org, and voila!!