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 install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: extract-text-webpack-plugin@1.0.1
npm ERR! Found: webpack@3.12.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^3.6.0" from the root project
npm ERR! peer webpack@"2 || 3 || 4" from babel-loader@7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader@"^7.1.1" from the root project
npm 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.1
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm 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.log

2.使用npm install --save --legacy-peer-deps安装依赖

npm install --save --legacy-peer-deps

仍然出现错误,如下:

npm ERR! code 1
npm ERR! path I:\fontend\2\mango-ui\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\ADMINI~1\AppData\Local\Temp\postinstall-b7425044.cmd
npm 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= --l
ibsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm 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.0
npm ERR! gyp info using node@16.17.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm 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 PATH
npm ERR! gyp verb `which` succeeded C:\Users\Administrator\.windows-build-tools\python27\python.exe C:\Users\Administrator\.windows-build-tools\python27\python.exe
npm ERR! gyp verb check python version `C:\Users\Administrator\.windows-build-tools\python27\python.exe -c "import sys; print "2.7.15
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.17.1
npm 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.1
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.17.1
npm ERR! gyp verb build dir attempting to create "build" dir: I:\fontend\2\mango-ui\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? I:\fontend\2\mango-ui\node_modules\node-sass\build
npm ERR! gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.19041
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.VC.MSBuild.Base
npm ERR! gyp verb find vs2017 - Using this installation with Windows 10 SDK
npm ERR! gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: I:\fontend\2\mango-ui\node_modules\node-sass\build\config.gypi
npm 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.gypi
npm ERR! gyp verb common.gypi checking for gypi file: I:\fontend\2\mango-ui\node_modules\node-sass\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn C:\Users\Administrator\.windows-build-tools\python27\python.exe
npm 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 Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir C:\Users\Administrator\.node-gyp\16.17.1
npm ERR! gyp verb found first Solution file build/binding.sln
npm ERR! gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm 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 EXCEPTION
npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENT
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:478:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm 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-sass
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm 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: 7 npm 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

查看错误,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
DONE Compiled successfully in 18305ms 下午10:43:07
I Your application is running here: http://localhost:8080

5. 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的更多相关文章

  1. 升级OS10.11系统后 Xcode6.4的变化少了个按钮 could not launch “Xcode” Xcode 插件安装

    升级OS10.11系统后 Xcode6.4的变化少了个按钮 could not launch “Xcode”  Xcode 插件安装 A:  升级10.11后Xcode 左上角模拟器选择菜单不在了   ...

  2. 解决升Win10系统后VMware虚拟机不能联网的问题

    刚升级到Win10系统,打开虚拟机发现不能联网,其实是系统服务项里缺少两个用到的服务,不能联网了,下面教大家解决联网问题. 1.打开VMware虚拟机主页,点击“编辑——虚拟网络编辑器”. 2.点击左 ...

  3. 【原】安装Win7和Ubuntu双系统后,Win7耳机无声音的解决办法

    最近安装了Ubuntu的桌面版,作成了双系统,可是发现了一个问题:进入Win7后有时插耳机会没有声音,外放有声音.后来更新驱动也没有解决问题,最后在网上查到了解决办法. 产生原因:进入Ubuntu后, ...

  4. 【解决方法】安装Win7和linux双系统后,linux报错“无法分配所提交的分区 not enough free space on disks”问题,以及win7无法启动“BootMGR image is corrupt....”问题

    近日,在笔记本上重装了Win7 企业版(64位)后,想装个linux双系统,于是开始安装 centOS 6.2(光盘安装) 硬盘分了一个主分区(c盘),一个扩展分区(3个逻辑分区:d,e,f盘),然后 ...

  5. win7下装ubuntu双系统后无法进入win7的解决方法

    本来电脑的系统是win7,然后用u盘装了ubuntu之后可能会出现开机没有引导界面而直接进入ubuntu系统的情况. 原因:没有设置gurb引导 解决方法:需要更新gurb来使ubuntu识别出win ...

  6. Win7升级Win10系统提示错误0x80070057的解决方法

    Win7系统用户在通过Windows Update来升级Win10系统时,有时会出现0x80070057的错误代码从而导致无法继续升级.下面好系统重装助手就来告诉大家Win7升级Win10系统出现0x ...

  7. 升级iOS8系统后,保险箱Pro、私人保险箱、私密相冊打开就闪退的官方解决方式

    升级iOS8系统后,保险箱Pro.私人保险箱.私密相冊打开就闪退的官方解决方式   写在前面的话: 1.   本文适用条件    适用于:您的保险箱Pro.私人保险箱.私密相冊在iPhone或iPad ...

  8. 升级mac Mojave系统,git无法使用

    升级mac Mojave系统后 无法使用git,出现如下问题 xcrun: error: invalid active developer path (/Library/Developer/Comma ...

  9. 如何解决Win10系统更新显示0x80080300代码的错误?

    Win10系统自推出以来就不断的在完善更新,其越来越丰富的功能也吸引了越来越多的用户.好系统Win10系统:https://www.vkebao.com/os/index_2.html但最近有用户反映 ...

随机推荐

  1. Lua 语言

    # Lua是一种轻量.小巧的脚本语言,用标准C语言编写并以源码形式开发.设计的摸底是为了嵌入到其他应用程序中,从而为应用程序提供灵活的拓展和定制功能. # Lua安装 # 官网:https://www ...

  2. cache2go-源码阅读

    简介 cache2go 是非常简短的 go 开源项目了,很适合作为第一个读源码项目. 如果你有一定的 go 开发经验,读起来会感觉到比较容易. 如果你刚刚接触 go 语音,基础知识还不完全了解,希望阅 ...

  3. C#/VB.NET 将PDF转为PDF/X-1a:2001

    PDF/X-1a是一种PDF文件规范标准,在制作.使用PDF以及印刷时所需要遵循的技术条件,属于PDF/X-1标准下的一个子标准. PDF/X-1标准有由CGATS于1999年制定的PDF/X-1:1 ...

  4. AgileFontSet迅捷字体设置程序

    AgileFontSet迅捷字体设置程序-用户手册  AgileFontSet的完整代码,参见 https://www.cnblogs.com/ybmj/p/11683291.html 1.程序特点和 ...

  5. Win32 - 窗口

    Win32 - 窗口 目录 Win32 - 窗口 前言 流程图 创建项目 VS MinGW Win32API字符串 Unicode 和 ANSI 函数 TCHAR WinMain:Win32 Appl ...

  6. D8调试工具——jsvu的使用细则

    d8 is V8's own developer shell. D8 是一个非常有用的调试工具,你可以把它看成是 debug for V8 的缩写.我们可以使用 d8 来查看 V8 在执行 JavaS ...

  7. Flutter 开启 Windows、macOS 平台支持的命令

    Flutter 的多平台支持除了 Android 和 iOS 是默认开启的以外,比如 Windows.Linux 平台的支持需要手动开启. Flutter config 命令集中,有以下参数是对于平台 ...

  8. 【NOI P模拟赛】混凝土粉末(整体二分)

    题面 样例输入 5 8 1 1 4 2 2 3 1 2 3 3 1 2 5 1 2 3 3 2 5 2 2 1 2 2 1 3 样例输出 1 0 4 0 1 0 样例解释 题解 比这道题简单了不知多少 ...

  9. 被一位读者赶超,手摸手 Docker 部署 ELK Stack

    被一位读者赶超,容器化部署 ELK Stack 你好,我是悟空. 被奇幻"催更" 最近有个读者,他叫"老王",外号"茴香豆泡酒",找我崔更 ...

  10. python的环境,你再也不用愁-conda

    Conda Guide Conda简介 conda是一个包,依赖和环境管理工具,适用于多种语言,如: Python, R, Scala, Java, Javascript, C/ C++, FORTR ...