Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm version is failing and I have the lastest #418

Closed
amejiarosario opened this issue May 27, 2019 · 20 comments
Closed

npm version is failing and I have the lastest #418

amejiarosario opened this issue May 27, 2019 · 20 comments

Comments

@amejiarosario
Copy link

amejiarosario commented May 27, 2019

Description

I'm using npm 6.9.0 and np is still complaining:

image

Steps to reproduce

  1. np

Expected behavior

Go through since my npm is up to date

Environment

np - 5.0.2
Node.js - 10.12.0
npm - 6.9.0
Git - 2.19.1
OS - Mac OS X 10.14.4 (build 18E226)

@malexsan1
Copy link

I am experiencing the same issue using node 10.15.3 and npm 6.9.0. I can make it work by switching to the latest node version (12.3.1), but my whole testing environment expects node 10, so I need to just go --yolo. 😢

@itaisteinherz
Copy link
Collaborator

itaisteinherz commented May 28, 2019

I couldn't reproduce this locally on my machine (using Node v10.12.0, npm v6.9.0 and np v5.0.2).
Can you try running npm i node -e "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))" and comment the output of the command?

@amejiarosario
Copy link
Author

@itaisteinherz

$ npm i node -e "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))"
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))": Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/admejiar/.npm/_logs/2019-05-28T13_54_56_616Z-debug.log

@itaisteinherz
Copy link
Collaborator

@amejiarosario Sorry, I meant node -e "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))". For some reason the npm i was added.

@amejiarosario
Copy link
Author

amejiarosario commented May 29, 2019

@itaisteinherz

$ node -e "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))"
false

$ npm -v
6.9.0

@itaisteinherz
Copy link
Collaborator

itaisteinherz commented May 29, 2019

@amejiarosario I have no idea why you're experiencing this issue 😕
If you could try to debug this yourself and let us know what you come up with that would be awesome, but otherwise I don't think I can do anything to help with this other than change the minimum required version of Node.js to be v12.

@janpio
Copy link
Contributor

janpio commented May 29, 2019

Possibly silly question, but:
How did you install node?
How did you install/upgrade npm on that node?

(Used to have similar problems with version checks with older versions of nvm-windows in the past - maybe you two share something like that)

@amejiarosario
Copy link
Author

I installed Node using asdf nodejs and updated npm using npm i -g npm

@janpio
Copy link
Contributor

janpio commented May 29, 2019

If I were you and wanted to debug this, I would find my local installation of np and add a few console.log to line 88 in

np/source/npm/util.js

Lines 86 to 92 in 71880f9

exports.verifyRecentNpmVersion = async () => {
const npmVersion = await exports.version();
if (version(npmVersion).satisfies('<6.8.0')) {
throw new Error('Please upgrade to npm@6.8.0 or newer');
}
};

console.log('npmVersion', npmVersion)
console.log('version(npmVersion)', version(npmVersion)) 

might tell you something.

@amejiarosario
Copy link
Author

I tried but console.log were not printed on the stdout. Not sure if they are being redirected. I just commented out line 90 and everything worked :) But, it's annoying, every time I update this package I'd have to comment out the throw error.

@janpio
Copy link
Contributor

janpio commented May 29, 2019

Oh right, that list runner thing probably. Then I would add it to the error that is thrown ;)

@itaisteinherz
Copy link
Collaborator

console.log('npmVersion', npmVersion)
console.log('version(npmVersion)', version(npmVersion)) 

Also:

console.log('version satisfies, version(npmVersion).satisfies('<6.8.0'));

@saulimus
Copy link

saulimus commented Jun 5, 2019

My project uses auditjs, which has npm ^5.6.0 as a dependency.
await execa.stdout('whereis', ['npm']); shows that it is using "/node_modules/.bin/npm" instead of globally installed npm, which for me is 6.9.0.
Is there a way to force np to use the global one?
Actually, as np is installed as global anyways, it should imo never try to use local binaries but use global npm.

Seems to be related to this issue: sindresorhus/execa#153 (comment)

@itaisteinherz
Copy link
Collaborator

@saulimus See #410.

@Anadian
Copy link

Anadian commented Jun 18, 2019

Having this same issue with Node 12.4.0 (installed via HomeBrew), NPM 6.9.0 (installed via npm i -g npm), and np 5.0.3 (installed via npm i -g np); node -e "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))" just prints false; and I don't believe I have any "local" npm binaries installed: has anyone actually figured out a real solution for this yet?

@itaisteinherz
Copy link
Collaborator

@amejiarosario @saulimus @Anadian Can you check out #410 and see if it fixed the issue for you?

@matjack1
Copy link

matjack1 commented Jul 3, 2019

just to give a feedback, I'm using np v5.0.3, following the thread in #410, but I'm still experiencing the problem as the others :(

@matjack1
Copy link

I've managed to solve the issue by reinstalling node (with asdf) and then running the local version of np (yarn run np).

If you do that you have also to run yarn login as only npm login won't be enough.

@phBalance
Copy link

Just to leave another data point and a few bread crumbs. In my case I'm running Linux so YMMV.

I have package npm installed which installs to /usr/bin/npm and is version 3.5.2 or something similarly old. I do have npm installed "globally (via npm i -g npm)" to /usr/local/bin/npm - it's the one that is run by my shell and it's version 6.11.3.

I did a little debugging and found that the exports.version = () => execa.stdout('npm', ['--version']); was picking the npm version from /usr/bin/npm rather than /usr/local/bin/npm.

I'm not sure why there's a difference in $PATH between my shell and the execa, but uninstalling the ubuntu npm package was a simple enough work around.

@fregante
Copy link
Collaborator

fregante commented Feb 3, 2023

No report since 2019, closing

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants