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

1. 错误npm ERR! code ERESOLVE系统从win7升级到win10,之前的node版本是13.14.0,现在版本是16.17.1 。正常的vue程序无法正常运行 。从网上查询得知"node-sass": "^4.14.1"需要安装python2.7vs_BuildTools , 于是安装python2.7visual C++2019,设置npm config set python C:\\Users\\Administrator\\.windows-build-tools\\python27\\python.exe
运行程序,仍然报错 。一气之下删除node_modules文件夹,重新npm安装依赖包 。
结果出现npm ERR! ERESOLVE could not resolve错误,如下:
I:\fontend\2\mango-ui>npm installnpm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR!npm ERR! While resolving: extract-text-webpack-plugin@1.0.1npm ERR! Found: webpack@3.12.0npm ERR! node_modules/webpacknpm ERR!dev webpack@"^3.6.0" from the root projectnpm ERR!peer webpack@"2 || 3 || 4" from babel-loader@7.1.5npm ERR!node_modules/babel-loadernpm ERR!dev babel-loader@"^7.1.1" from the root projectnpm ERR!8 more (file-loader, friendly-errors-webpack-plugin, ...)npm ERR!npm ERR! Could not resolve dependency:npm ERR! peer webpack@"^1.9.11" from extract-text-webpack-plugin@1.0.1npm ERR!npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.npm ERR!npm ERR! See H:\tools\nodejs\node_cache\eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in:npm ERR!H:\tools\nodejs\node_cache\_logs\2022-10-09T13_31_26_126Z-debug-0.log2.使用npm install --save --legacy-peer-deps安装依赖npm install --save --legacy-peer-deps仍然出现错误,如下:
npm ERR! code 1npm ERR! path I:\fontend\2\mango-ui\node_modules\node-sassnpm ERR! command failednpm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\ADMINI~1\AppData\Local\Temp\postinstall-b7425044.cmdnpm ERR! Building: D:\Program Files\nodejs\node.exe I:\fontend\2\mango-ui\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=npm ERR! gyp info it worked if it ends with oknpm ERR! gyp verb cli [npm ERR! gyp verb cli'D:\\Program Files\\nodejs\\node.exe',npm ERR! gyp verb cli'I:\\fontend\\2\\mango-ui\\node_modules\\node-gyp\\bin\\node-gyp.js',npm ERR! gyp verb cli'rebuild',npm ERR! gyp verb cli'--verbose',npm ERR! gyp verb cli'--libsass_ext=',npm ERR! gyp verb cli'--libsass_cflags=',npm ERR! gyp verb cli'--libsass_ldflags=',npm ERR! gyp verb cli'--libsass_library='npm ERR! gyp verb cli ]npm ERR! gyp info using node-gyp@3.8.0npm ERR! gyp info using node@16.17.1 | win32 | x64npm ERR! gyp verb command rebuild []npm ERR! gyp verb command clean []npm ERR! gyp verb clean removing "build" directorynpm ERR! gyp verb command configure []npm ERR! gyp verb check python checking for Python executable "C:\Users\Administrator\.windows-build-tools\python27\python.exe" in the PATHnpm ERR! gyp verb `which` succeeded C:\Users\Administrator\.windows-build-tools\python27\python.exe C:\Users\Administrator\.windows-build-tools\python27\python.exenpm ERR! gyp verb check python version `C:\Users\Administrator\.windows-build-tools\python27\python.exe -c "import sys; print "2.7.15npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %jnpm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.17.1npm ERR! gyp verb command install [ '16.17.1' ]npm ERR! gyp verb install input version string "16.17.1"npm ERR! gyp verb install installing version: 16.17.1npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installednpm ERR! gyp verb install version is already installed, need to check "installVersion"npm ERR! gyp verb got "installVersion" 9npm ERR! gyp verb needs "installVersion" 9npm ERR! gyp verb install version is goodnpm ERR! gyp verb get node dir target node version installed: 16.17.1npm ERR! gyp verb build dir attempting to create "build" dir: I:\fontend\2\mango-ui\node_modules\node-sass\buildnpm ERR! gyp verb build dir "build" dir needed to be created? I:\fontend\2\mango-ui\node_modules\node-sass\buildnpm ERR! gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildToolsnpm ERR! gyp verb find vs2017- Found Microsoft.VisualStudio.Component.Windows10SDK.19041npm ERR! gyp verb find vs2017- Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64npm ERR! gyp verb find vs2017- Found Microsoft.VisualStudio.VC.MSBuild.Basenpm ERR! gyp verb find vs2017- Using this installation with Windows 10 SDKnpm ERR! gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildToolsnpm ERR! gyp verb build/config.gypi creating config filenpm ERR! gyp verb build/config.gypi writing out config file: I:\fontend\2\mango-ui\node_modules\node-sass\build\config.gypinpm ERR! (node:3484) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)npm ERR! gyp verb config.gypi checking for gypi file: I:\fontend\2\mango-ui\node_modules\node-sass\config.gypinpm ERR! gyp verb common.gypi checking for gypi file: I:\fontend\2\mango-ui\node_modules\node-sass\common.gypinpm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"npm ERR! gyp info spawn C:\Users\Administrator\.windows-build-tools\python27\python.exenpm ERR! gyp info spawn args [npm ERR! gyp info spawn args'I:\\fontend\\2\\mango-ui\\node_modules\\node-gyp\\gyp\\gyp_main.py',npm ERR! gyp info spawn args'binding.gyp',npm ERR! gyp info spawn args'-f',npm ERR! gyp info spawn args'msvs',npm ERR! gyp info spawn args'-G',npm ERR! gyp info spawn args'msvs_version=2015',npm ERR! gyp info spawn args'-I',npm ERR! gyp info spawn args'I:\\fontend\\2\\mango-ui\\node_modules\\node-sass\\build\\config.gypi',npm ERR! gyp info spawn args'-I',npm ERR! gyp info spawn args'I:\\fontend\\2\\mango-ui\\node_modules\\node-gyp\\addon.gypi',npm ERR! gyp info spawn args'-I',npm ERR! gyp info spawn args'C:\\Users\\Administrator\\.node-gyp\\16.17.1\\include\\node\\common.gypi',npm ERR! gyp info spawn args'-Dlibrary=shared_library',npm ERR! gyp info spawn args'-Dvisibility=default',npm ERR! gyp info spawn args'-Dnode_root_dir=C:\\Users\\Administrator\\.node-gyp\\16.17.1',npm ERR! gyp info spawn args'-Dnode_gyp_dir=I:\\fontend\\2\\mango-ui\\node_modules\\node-gyp',npm ERR! gyp info spawn args'-Dnode_lib_file=C:\\Users\\Administrator\\.node-gyp\\16.17.1\\<(target_arch)\\node.lib',npm ERR! gyp info spawn args'-Dmodule_root_dir=I:\\fontend\\2\\mango-ui\\node_modules\\node-sass',npm ERR! gyp info spawn args'-Dnode_engine=v8',npm ERR! gyp info spawn args'--depth=.',npm ERR! gyp info spawn args'--no-parallel',npm ERR! gyp info spawn args'--generator-output',npm ERR! gyp info spawn args'I:\\fontend\\2\\mango-ui\\node_modules\\node-sass\\build',npm ERR! gyp info spawn args'-Goutput_dir=.'npm ERR! gyp info spawn args ]npm ERR! gyp verb command build []npm ERR! gyp verb build type Releasenpm ERR! gyp verb architecture x64npm ERR! gyp verb node dev dir C:\Users\Administrator\.node-gyp\16.17.1npm ERR! gyp verb found first Solution file build/binding.slnnpm ERR! gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exenpm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exenpm ERR! gyp info spawn args [npm ERR! gyp info spawn args'build/binding.sln',npm ERR! gyp info spawn args'/nologo',npm ERR! gyp info spawn args'/p:Configuration=Release;Platform=x64'npm ERR! gyp info spawn args ]npm ERR! gyp ERR! UNCAUGHT EXCEPTIONnpm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENTnpm ERR! gyp ERR! stackat Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)npm ERR! gyp ERR! stackat onErrorNT (node:internal/child_process:478:16)npm ERR! gyp ERR! stackat processTicksAndRejections (node:internal/process/task_queues:83:21)npm ERR! gyp ERR! System Windows_NT 10.0.19044npm ERR! gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "I:\\fontend\\2\\mango-ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="npm ERR! gyp ERR! cwd I:\fontend\2\mango-ui\node_modules\node-sassnpm ERR! gyp ERR! node -v v16.17.1npm ERR! gyp ERR! node-gyp -v v3.8.0npm ERR! gyp ERR! This is a bug in `node-gyp`.npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:npm ERR! gyp ERR!<https://github.com/nodejs/node-gyp/issues>npm ERR! Build failed with error code: 7npm ERR! A complete log of this run can be found in:npm ERR!H:\tools\nodejs\node_cache\_logs\2022-10-09T14_15_40_435Z-debug-0.log

推荐阅读