求助:无法安装@angular/cli@7.0.0版本的问题
Let’s work through this issue— I’ve dealt with similar package version lookup problems before, and there are a few solid fixes to try when a version you know exists isn’t showing up in npm.
Step 1: Verify the version actually exists first
First, confirm that @angular/cli@7.0.0 is indeed available in the npm registry. Run this command to list all published versions of the package:
npm view @angular/cli versions
If 7.0.0 doesn’t appear in the output, the problem is likely with your npm registry (more on that below). If it does show up, move to the next steps.
Step 2: Clear your npm cache
Outdated cache is one of the most common reasons npm can’t find existing package versions. Clear it with:
npm cache clean --force
After clearing, try installing the version again:
npm i -g @angular/cli@7.0.0
Step 3: Switch to the official npm registry
If you’re using a third-party registry (like Taobao mirror, for example), it’s possible that specific older versions (like 7.0.0) weren’t fully synced. Switch to the official registry with:
npm config set registry https://registry.npmjs.org/
Then retry the install command.
Step 4: Install directly from the package tarball
If the above steps fail, you can bypass npm’s version lookup entirely by installing directly from the official tarball URL for @angular/cli@7.0.0:
npm install -g https://registry.npmjs.org/@angular/cli/-/cli-7.0.0.tgz
Step 5: Check npm version compatibility
Angular CLI 7.0.0 is designed to work with npm 5.x or 6.x. If you’re running a much newer npm version (like 8+), compatibility issues might be causing the version lookup to fail. You can downgrade npm to a compatible version first:
npm install -g npm@5.10.0
Then try installing @angular/cli@7.0.0 again.
The reason 7.0.1 works is likely because third-party registries often prioritize syncing more recent patch versions, while older ones like 7.0.0 might get overlooked. Sticking to the official registry or using the direct tarball install should resolve this.
内容的提问来源于stack exchange,提问作者Doflamingo19

