win7升级到win10系统后,node13升级为node16,node版本node-sass版本与不匹配,导致出现npm ERR! ERESOLVE could not resolve( 二 )

查看错误,ERR最早出现仍然是node-sass,猜测仍然是node版本不匹配导致 。
3.单独安装node-sass在网上查询到可以通过单独安装node-sass解决问题,于是单独安装node-sass,如下:
npm install -s node-sass@4.14.1可以安装node-sass,无错误输出 。
运行程序npm run dev,出现下面问题:
I:\fontend\2\mango-ui>npm run dev> mango-ui@1.0.0 dev> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js'webpack-dev-server' 不是内部或外部命令,也不是可运行的程序或批处理文件 。再次运行npm install --save --legacy-peer-deps,错误依旧 。
4.修改package.json,增加 "node": "^13.14.0"在网上查询了好久都找不到解决方法,考虑到错误原因是node版本升级问题 。于是自己尝试将"node": "^13.14.0"添加到package.json"devDependencies"项下 。
"devDependencies": {"autoprefixer": "^7.1.2","babel-core": "^6.22.1","babel-helper-vue-jsx-merge-props": "^2.0.3","babel-loader": "^7.1.1","babel-plugin-syntax-jsx": "^6.18.0","babel-plugin-transform-runtime": "^6.22.0","babel-plugin-transform-vue-jsx": "^3.5.0","babel-preset-env": "^1.3.2","babel-preset-stage-2": "^6.22.0","chalk": "^2.0.1","copy-webpack-plugin": "^4.0.1","css-loader": "^0.28.0","extract-text-webpack-plugin": "^1.0.1","file-loader": "^1.1.4","friendly-errors-webpack-plugin": "^1.6.1","html-webpack-plugin": "^2.30.1","mockjs": "^1.0.1-beta3","node": "^13.14.0","node-notifier": "^5.1.2","node-sass": "^4.14.1","optimize-css-assets-webpack-plugin": "^3.2.0","ora": "^1.2.0","portfinder": "^1.0.13","postcss-import": "^11.0.0","postcss-loader": "^2.0.8","postcss-url": "^7.2.1","rimraf": "^2.6.0","sass-loader": "^7.3.1","semver": "^5.3.0","shelljs": "^0.7.6","style-loader": "^3.1.0","uglifyjs-webpack-plugin": "^1.1.1","url-loader": "^4.1.1","vue-loader": "^13.3.0","vue-style-loader": "^3.0.1","vue-template-compiler": "^2.5.2","webpack": "^3.6.0","webpack-bundle-analyzer": "^2.9.0","webpack-dev-server": "^2.9.1","webpack-merge": "^4.1.0"},再次运行npm install --save --legacy-peer-deps,无错误,且node_modules中会下载node13.14.0.exe
运行npm run dev,程序正常运行,如下:
I:\fontend\2\mango-ui>npm run dev> mango-ui@1.0.0 dev> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 95% emitting DONECompiled successfully in 18305ms下午10:43:07 IYour application is running here: http://localhost:80805. nodenode-sass版本不匹配解决方法经反复测试,当出现node版本不匹配问题时,可通过以下方法解决:
1. 删除旧的"node_modules"文件夹;2. 修改"package.json",在"devDependencies"中增加"node": "^13.14.0"依赖;3. npm install -s node-sass@4.14.1;4. npm install --save --legacy-peer-deps;5. npm run dev【win7升级到win10系统后,node13升级为node16,node版本node-sass版本与不匹配,导致出现npm ERR! ERESOLVE could not resolve】

经验总结扩展阅读