Ask Your Question
0

Error running Node js npm - Cannot find module '../lib/npm.js'

asked 2013-10-11 23:10:43 -0500

joseluisq gravatar image

updated 2014-09-09 00:10:44 -0500

Hi, I can't use npm for Node js on my fedora 18
First I installed nodejs on fedora :

# yum install npm

And then when I use npm :

# npm yo
module.js:333
    throw err;
          ^
Error: Cannot find module '../lib/npm.js'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at /usr/lib/node_modules/npm/bin/npm-cli.js:24:11
    at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:86:3)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)

Thanks in advance :)

edit retag flag offensive close merge delete

Comments

this sounds like a bug. Irecommend you open a bugzilla ticket for that ("npm yo" works for me just fine on F19).

Felix Schwarz gravatar imageFelix Schwarz ( 2013-10-12 16:00:10 -0500 )edit

Ok, Thanks

joseluisq gravatar imagejoseluisq ( 2013-10-12 21:05:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-10-12 21:04:32 -0500

joseluisq gravatar image

I found the solution:
Remove /usr/lib/node_modules folder
Then remove nodejs and npm via yum remove nodejs npm

Finally back to install nodejs and npm via yum:

yum install nodejs npm
edit flag offensive delete link more

Comments

1

Thanks for the workaround, it works. Won't it be faster to remove packages before deleting folders?

omarkhovskyi gravatar imageomarkhovskyi ( 2014-01-02 07:49:11 -0500 )edit

Hi, it's because for a stranger reason, remove via yum doesn't remove all necessary folders. Then I decided to use sudo rm -rf /usr/lib/node_modules

joseluisq gravatar imagejoseluisq ( 2014-01-02 10:51:40 -0500 )edit

I needed to run a full reinstall after nuking the node directory for npm to work. sudo dnf reinstall nodejs-*

rayfoss gravatar imagerayfoss ( 2016-02-23 11:01:24 -0500 )edit

removed/ usr/lib/node_modules folder Then remove nodejs and npm via yum remove nodejs npm

then # yum install nodejs npm Loaded plugins: priorities, update-motd, upgrade-helper No package nodejs available. No package npm available. Error: Nothing to do

Ashish Karpe gravatar imageAshish Karpe ( 2017-09-15 06:47:24 -0500 )edit

Question Tools

Stats

Asked: 2013-10-11 23:10:43 -0500

Seen: 22,079 times

Last updated: Sep 09 '14