Comments (33)
@visionmedia are you trolling me?
from n.
thanks to the terrible directory structure of *nix we need to just install a bunch more crap. #62
from n.
Reinstalling NPM (curl http://npmjs.org/install.sh | sh) fixed it for v0.6.13, but now I can't install anything in 0.4.7 because of...
Error: npm doesn't work with node v0.4.7
Required: [email protected] || 0.7 || 0.8
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:67:23
at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:87:2)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array.0 (module.js:423:10)
at EventEmitter._tickCallback (node.js:126:26)
How can I run 2 different versions of NPM?
from n.
+1
from n.
+1
from n.
In case this helps others...
You can still use N to toggle between 0.4.x and 0.6.x, but each time you need to install the right version of NPM. To install an old version of NPM, follow the instructions I wrote here: http://blog.grandelabs.com/post/20069207998/how-to-install-an-old-version-of-npm
Just an interim solution until the awesome guys at visionmedia can fix this. Cheers!
from n.
It seems like this was working in a past version of n. Is that true? If so, presumably we could just use an old version of n.
from n.
I got also this:
npm --version
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '../lib/utils/log.js'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at /usr/local/bin/npm:18:11
at Object. (/usr/local/bin/npm:87:2)
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)
So I was pushed to use it like this: /usr/local/n/current/bin/npm --version
from n.
+1. Had to uninstall n.
from n.
I just finished a fresh install of Ubuntu. My plan was to use n
to install my first version of node.js, so that I could start using node version management from the get-go. n
worked great to install node.js, but does not seem to configure everything so that it's also friendly with npm
. npm just does not work. I am seeing the same error as noted by @deianvasilev two comments up. Here is some output from my system.
ryan@ryan-server:~$ n
/usr/local/bin/node
ο 0.6.15
0.7.8
ryan@ryan-server:~$ n -V
0.7.1
ryan@ryan-server:~$ npm
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '../lib/utils/log.js'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at /usr/local/bin/npm:18:11
at Object.<anonymous> (/usr/local/bin/npm:87:2)
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)
from n.
+1 to this issue
and
+1 to @deremer 's temporary fix (which also worked for 0.6.x <-> 0.7.x)
In case this helps others...
You can still use N to toggle between 0.4.x and 0.6.x, but each time you need to install the right version of NPM. To install an old version of NPM, follow the instructions I wrote here: http://blog.grandelabs.com/post/20069207998/how-to-install-an-old-version-of-npm
Just an interim solution until the awesome guys at visionmedia can fix this. Cheers!
from n.
astro/node-expat#16 Having similar issues
from n.
+1
from n.
I had to remove ~/.npm and ~/.npmrc to get this working again, dunno which of the folders made it work.
from n.
ok, so had the same issue: looks like the problem is that /usr/local/bin/npm is populated with the npm file instead of a symbolic link to the current npm version (/usr/local/n/current/bin/npm).
I'm sure there's a more robust fix -- @visionmedia am I missing something here? would be great to update n to take care of this pesky npm issue :)
cheers,
Adam
from n.
as long as we copy everything from the build it should just work
from n.
Looking in /usr/local/bin/npm you can see it references a relative directory ("../lib/ ... "). I think that's what's breaking.
How should we resolve it? Is there a down-side to using symbolic links to the current version instead of copying?
from n.
symlinks should be fine, i just went with copying originally because it was the first thing i wrote and the time it took was negligible so i didn't bother with symlinks :D
from n.
+1 :(
from n.
+1
My temp fix:
cd /usr/local/bin
mv npm npm.old
ln -s /usr/local/n/current/bin/npm .
from n.
+1
from n.
+1
from n.
mkdir ~/local
export PATH=~/local/bin:"$PATH"
curl http://npmjs.org/install.sh | npm_config_prefix=~/local sh
now i can do:
patrick@ilvy ~ $ which npm
/home/patrick/bin/npm
patrick@ilvy ~ $ npm -v
1.1.32
patrick@ilvy ~ $ n -V
0.7.2
patrick@ilvy ~ $ node -v
v0.6.19
patrick@ilvy ~ $ sudo n 0.8.0
/usr/local/bin/node
patrick@ilvy ~ $ node -v
v0.8.0
patrick@ilvy ~ $ which npm
/home/patrick/bin/npm
patrick@ilvy ~ $ npm -v
1.1.32
patrick@ilvy ~ $ sudo n 0.6.19
/usr/local/bin/node
patrick@ilvy ~ $ node -v
v0.6.19
patrick@ilvy ~ $ which npm
/home/patrick/bin/npm
patrick@ilvy ~ $ npm -v
1.1.32
from n.
oh.. with sudo npm it still sucks this way :/
from n.
+1
going from 0.8.0 to 0.6.19
module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module '../lib/utils/log.js'
from n.
+1
from n.
+1
from n.
you can do n 0.8.0 --without-npm
then it will only install node without npm
if you have already installed a node with npm (via n), just remove $n_prefix/versions/<node-version>/bin/npm
this way n will not destroy npm, but one has to install npm manually (which i prefer anyways)
we could hardcode it (https://github.com/visionmedia/n/blob/master/bin/n#L196), since most users of n will use a custom installed npm anyway?
actually i think the best solution would be to hardcode it into node :P
from n.
In your .bashrc if your ok with relying on what ever n is doing
alias npm="n npm node -v
"
from n.
+1 for n having a 'meh' attitude to node_modules, great idea but poorly executed.
from n.
with all the pullrequests that have slowly kinda messed things up this could use a rewrite entirely, plus now we have binaries to install instead
from n.
I agree with this issue it kind of makes this module useless
from n.
2+
from n.
Related Issues (20)
- Improve doc for Mac OS (Ventura) with homebrew HOT 6
- Is there a way to install from .tgz or binary file instead of downloading from remote? HOT 3
- TypeError: Class extends value undefined is not a constructor or null - fs-minipass HOT 2
- export N_NODE_MIRROR failed to work HOT 2
- Add Node.js 14.21.4 ? HOT 4
- How to run n on Win11 arm64? HOT 3
- Download version indexes failure, version switch failure!
- Download version indexes failure, version switch failure! HOT 6
- Using a cached download fails HOT 5
- Hlo HOT 1
- Cron cannot find node HOT 7
- /usr/local vs. /usr/local/bin HOT 2
- Fresh install of n can't be used HOT 8
- Add a new command (say `use`) to switch to preinstalled versions of Node.js HOT 12
- Retry when downloading/extraction of Node.js tar fails HOT 12
- OS recogonition mistakes HOT 4
- Modify repo "About" to match npm search criteria HOT 1
- LTS downloading stable instead of LTS HOT 3
- corepack is not removed when downgrading node HOT 4
- Default install location (N_PREFIX) to home HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from n.