np
np copied to clipboard
npm version is failing and I have the lastest
Description
I'm using npm 6.9.0 and np is still complaining:

Steps to reproduce
- 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)
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. 😢
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?
@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
@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.
@itaisteinherz
$ node -e "console.log(require('semver').satisfies('6.9.0', '<6.8.0'))"
false
$ npm -v
6.9.0
@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.
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)
I installed Node using asdf nodejs and updated npm using npm i -g npm
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 https://github.com/sindresorhus/np/blob/71880f97c5527737dbff5c3f9c0b01ac9cade8cb/source/npm/util.js#L86-L92
console.log('npmVersion', npmVersion)
console.log('version(npmVersion)', version(npmVersion))
might tell you something.
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.
Oh right, that list runner thing probably. Then I would add it to the error that is thrown ;)
console.log('npmVersion', npmVersion) console.log('version(npmVersion)', version(npmVersion))
Also:
console.log('version satisfies, version(npmVersion).satisfies('<6.8.0'));
My project uses auditjs, which has npm ^5.6.0 as a dependency.
await execa.stdout('whereis', ['npm']); shows that it is using "
Seems to be related to this issue: https://github.com/sindresorhus/execa/issues/153#issuecomment-472404357
@saulimus See #410.
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?
@amejiarosario @saulimus @Anadian Can you check out #410 and see if it fixed the issue for you?
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 :(
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.
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.
No report since 2019, closing