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. 手动从0搭建ABP框架-ABP官方完整解决方案和手动搭建简化解决方案实践

      本文主要讲解了如何把ABP官方的在线生成解决方案运行起来,并说明了解决方案中项目间的依赖关系.然后手动实践了如何从0搭建了一个简化的解决方案.ABP官方的在线生成解决方案源码下载参考[3],手动搭 ...

  2. Linux系列之比较命令

    前言 Linux中有两个比较命令,它们分别是comm和diff,在比较文本文件的版本时通常很有用.本文介绍它们的区别和简单用法. comm命令 该命令对两个文本文件进行比较,并显示每个文件独有的行和它 ...

  3. 第三讲 Linux测试

    3.1 Linux操作系统定义 Ø我们为什么要学习这个linux系统呢? 那是因为我们很多的服务都放在这个linux系统,那为什么很多服务都要放到这个linux系统?这是因为linux系统好,它系统稳 ...

  4. Luogu1502 窗口的星星 (线段树扫描线)

    将每个点拓展为矩形,将\(y\)离散,延\(x\)轴扫描,每次更新最值 用了一百年的pushdown操作疑似有问题,亦或这道题特殊,我乱改了pushdown位置就过了,我能怎么办,WA了一发,y数组没 ...

  5. flutter系列之:widgets,构成flutter的基石

    目录 简介 StatelessWidget和StatefulWidget StatelessWidget详解 StatefulWidget详解 总结 简介 flutter中所有的组件都是由widget ...

  6. Linux 安装 Tomcat 详细教程

    Linux 安装Tomcat详细步骤 1. 前往tomcat官网复制下载链接, tomcat官网地址:https://tomcat.apache.org/ 2. 进入到指定目录,使用 wget 命令下 ...

  7. 事物的隔离性和MVCC

    事物的隔离性 mysql的服务端是支持多个客户端同时与之连接的,每个客户端可能还并发了好几个连接,所以mysql是需要同时处理很多事情的,每一件独立的事情就叫做事务.我们知道事务有一个叫隔离性的特性, ...

  8. Android下的IPC通信方式

    一.Bundle Android的Activity.Service.Receiver都支持在Intent传递Bundle数据,Bundle实现了Parcelable接口, 所以能很方便的在不同进程之间 ...

  9. 记一次python + selenium小项目出现的问题与解决办法

    记一次python + selenium小项目出现的问题与解决办法 如何接入代理 def crawl_xdaili(self):#代理 可不用 需要时 解除注释 """ ...

  10. Keepalived之简单有效的配置

    1.简介 官网地址:https://www.keepalived.org/ 源码包下载地址:https://www.keepalived.org/download.html Keepalived是一种 ...