npx does not look for latest version of package
Asked Answered
P

2

13

I was making a simple npm package, I deleted the first version i.e, v0.1.0. So there is no v0.1.0 for my package. But I published later versions, with latest being v0.3.0. But when I execute npx <package-name>, it does not install latest version(v0.3.0). Instead it throws the following error.

screenshot of error message

But when I specify the version of the package (npx <project-name>@v0.3.0),it works.
So how can I make npx install latest version with being mentioned explicitly?

https://www.npmjs.com/package/create-react-flask

Pepys answered 31/7, 2022 at 15:25 Comment(0)
B
13

This is how npx is designed to work. Basically it's always best to run npx with @latest appended to the package. So npx create-react-flask@latest in your case

See https://github.com/npm/cli/issues/4108

There's a (somewhat involved) workaround here: https://github.com/npm/cli/issues/2329#issuecomment-873487338

Beaker answered 19/12, 2022 at 19:26 Comment(1)
Apparantly @latest is good to force it to update the package you're directly running, but it doesn't update any dependencies. You have to use npx clear-npx-cache to do that.Harhay
P
12

Try clearing your cache by running either:

  • npm cache clean --force (built-in)

  • npx clear-npx-cache

After that, retry npx create-react-flask foobar

Pentaprism answered 31/7, 2022 at 15:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.