rishabh shukla
rishabh shukla

Reputation: 31

Why am I getting error "No valid versions available for undefined" while installing create-react-app

I'm trying to install React through command prompt. NodeJS is already installed.

When I try to run this command:

npm i -g create-react-app

It is displaying error as shown below:

npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xyz\AppData\Roaming\npm-cache\_logs\2019-12-10T10_51_39_2222-debug.log

Upvotes: 3

Views: 25282

Answers (5)

Mike Gledhill
Mike Gledhill

Reputation: 29213

I had this issue this morning, and my solution was to click on the log file.

It showed me this:

2992 verbose type range
2993 verbose stack Error: No valid versions available for undefined
2993 verbose stack     at pickManifest (C:\Program Files\choco\nodejs-14\14.17.1.2108041435\node_modules\npm\node_modules\npm-pick-manifest\index.js:39:11)
2993 verbose stack     ...etc...

So, I opened the file which threw the exception:

C:\Program Files\choco\nodejs-14\14.17.1.2108041435\node_modules\npm\node_modules\npm-pick-manifest\index.js

and changed line 39 from:

err = new Error(`No valid versions available for ${packument.name}`)

to

err = new Error(`No valid versions available for ${JSON.stringify(packument)}`)

I then re-ran "npm install", and this time, it showed the cause of the problem (I've split the one line into several lines, for readability):

npm ERR! No valid versions available for {
  "dist-tags":{}, 
  "versions":{},
  "success":false,
  "time":{
    "created":"2023-05-15T20:42:01.119Z",
    "modified":"2023-05-15T20:48:12.712Z"
  },
  "error":"Failed to stream response due to: Missing blob for crypto-js. 
     Unable to check remote crypto-js for retrieving latest copy.",
  "_cached":true,
  "_contentLength":0
}

So, this shows me that the cause of the problem is the package:

"crypto-js": "^4.1.1",

So, I needed to grab one of the valid versions from:

https://www.npmjs.com/package/crypto-js?activeTab=versions

You can also see why the error message was so hopeless.

Error: No valid versions available for undefined

Line 39 was attempting to display "name" from this error record, but there was no such field.

Upvotes: 0

Sankofa
Sankofa

Reputation: 659

For me this error came up because I had a version number that did not exist for a package I wanted.

Upvotes: 0

Simon Hardman
Simon Hardman

Reputation: 488

Sometimes this can happen when you are using a private NPM registry / proxy registry and it has corrupted metadata. I've seen this happen with Sonatype Nexus 3 - there were corresponding error messages in the server logs.

Upvotes: 4

Davit Mkrtchyan
Davit Mkrtchyan

Reputation: 469

you should check this out issue.

If the problem still exist, please check your versions with this:

npm -v  
node -v 

Upvotes: 0

Jolle
Jolle

Reputation: 1

Are you sure you have the right Node version? Try updating NodeJS or try running: npx create-react-app my-app

Upvotes: 0

Related Questions