9

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

Passerby
  • 9,715
  • 2
  • 33
  • 50
Nikhil
  • 91
  • 1
  • 5

2 Answers2

10

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

Lorenzo
  • 164
  • 11
10

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

Tobbe
  • 3,282
  • 6
  • 41
  • 53
  • 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. – Allon Guralnek May 29 '23 at 04:17