安装nodemon时出现“No valid versions available for timed-out”错误求助
Hey there, let's tackle this frustrating issue you're hitting when trying to install nodemon. That ENOVERSIONS error mentioning "No valid versions available for timed-out" is actually a misleading clue—it's almost always tied to corrupted npm cache data or wonky dependency resolution, not an issue with the nodemon package itself.
What's Going On?
From the stack trace you shared:
325 verbose stack timed-out: No valid versions available for timed-out
325 verbose stack at pickManifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\npm-pick-manifest\index.js:20:11)
...
331 error code ENOVERSIONS
332 error No valid versions available for timed-out
NPM is incorrectly trying to resolve a package called timed-out (a dependency in some npm internal tools) but can't find valid versions for it—this usually happens when your local cache has outdated or corrupted data about package versions.
Step-by-Step Fixes
Let's work through these solutions in order:
Clear the npm cache completely
Run this command to wipe out any corrupted cached package data:npm cache clean --forceRemove local package files
Delete thenode_modulesfolder (if it was created partially) andpackage-lock.jsonfile from your project directory. On Windows, you can do this via File Explorer, or use these commands:rmdir /s node_modules del package-lock.jsonReinstall nodemon
Try installing nodemon again, either without a version pin:npm install --save-dev nodemonOr if you specifically need the v1.14.7 version you tried earlier:
npm install --save-dev nodemon@1.14.7Check your npm registry
Sometimes connectivity issues with the default npm registry cause weird resolution errors. You can temporarily switch to a reliable mirror to test:npm install --save-dev nodemon --registry=https://registry.npmmirror.com(If this works, you can set it as your default registry permanently if needed.)
Consider upgrading Node.js (optional but recommended)
While you mentioned you updated to the "latest" version, Node.js v8.9.4 is actually quite outdated (it's no longer supported). Older Node/npm versions can have compatibility issues with modern package registry data. Upgrading to a current LTS version (like v18.x or v20.x) might prevent similar issues in the future.
Why This Worked on Another Computer
Your other machine likely had a clean cache or a newer Node/npm setup that didn't hit this corrupted cache issue. The problem is isolated to your local environment's cached data, not the project setup itself.
内容的提问来源于stack exchange,提问作者Warley Noleto

