Skip to main content

NPM / NODEJS installation issues [RESOLVED]

Yesterday I decided to give node.js and socket.io a shot and make something good out of it. The first thing that we do is install stuff right.. So I thought I'd go the easy way, wget all the installable packages from nodejs.org for the mac and I was hoping things would be stable.

But 'not' to my surprise (as this keeps on happening), when I started out using npm (the package manager or let's just say the easy_install python alias) that comes with the latest installer started giving me issues like the following whenever I typed npm install socket.io or even npm -v(to check the version) for that matter -

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: No such module
    at Object. (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object. (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)

After a good two hours of figuring out what the problem was (is the repo not updated? do I have the older version of npm that it doesn't let me even check the version of it? ..), turns out the installer installs two versions of npm - 

- One at /usr/bin/npm : The older version
- The other at /usr/local/bin/npm The latest version

Now as soon as I deleted the older version and all its dependencies on /usr/bin/npm and logged in again, the bash now picks up the newer version now and I'm happily using npm. 

Hope this helps someone with a mac.

Comments

  1. yes that happened with me as well, but i figured it out quite soon, thanks SUKHUS.

    ReplyDelete

Post a Comment

Popular posts from this blog

Startup founders cheatsheet (Chief product officer)

Define your goals  The basic definition of "mission" and "vision" of the company is critical when we've past the stage of experimenting with the startup's model and helps you prioritise better. From the Expedia page it looks like this: "Our Mission is to Revolutionise Travel Through the Power of Technology", in this case, it is also helping the company know that leveraging and scaling with "technology" is imperative for the company (along with operations). 
Set 2-3 basic targets for the next 2-3 months (possibly 6 months) These might be pretty standard and should align with the mission / vision of the company. If your company wants to be the #1 company in Asia for travel, these basic targets might be: Scale to 100,000 app downloads across platformsIncrease revenue by 15%Increase daily unique visitors to 3 times the current value 
Image Source: Mind the product
Goals help define epics and create a huge backlog Now brainstorming how the targe…

Image Cropping and Scaling Algorithm using "linear algebra"

THE SCENARIO:

I had to formulate an algorithm to convert an image of some resolution - say L x M and
crop / re-size the image into a new resolution say P x R such that I cover the maximum amount 
of points/pixels from the original image.

APPLICATION:
This can be pretty much applied in a generic way to all programs and websites in need of an optimized algorithm to rescale / reduce the size of the original image in their application such as profile images in social networks etc.

THE APPROACH:

To cover the maximum amount of pixels from the original image we have to focus on cropping the image
to the target aspect ratio first and then re-scaling it to the new resolution. Hence, the problem comes down to achieving the target aspect ratio that would help me capture the maximum amount of pixels of the original image so that I end up with an image which is pretty close to what the original image should have been in the new resolution.

DETAILS:

The signature of the function before we started writin…