在用vue 创建项目的时候遇到这个问题
npm does not support Node.js v14.3.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
You can find the latest version at https://nodejs.org/
npm ERR! code ETARGET
npm ERR! notarget No matching version found for stackframe@^1.3.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhangshiyu/.npm/_logs/2022-06-06T01_32_33_589Z-debug-0.log
ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
基本原因是因为升级了npm,但是没有升级node导致。后来我把node升级到最新稳定版本。结果报错已久。寻找良久,最后原因是node和npm版本不一协调导致。
解决方案
第一步,升级node到最新稳定版本
# 查看当前node版本
node -v
# 清除npm缓存
npm cache clean -f
# 全局安装n
npm install -g n
# 升级到最新稳定版
n stable
第二部,升降级npm到和node相匹配的版本
对照关系连接 nodejs.org/zh-cn/downl…
sudo npm install npm@对应版本 -g