系统的PATH环境变量已改,但是IDEA的Terminal环境变量为啥还是旧版本?

2023-12-11 19:29

本文主要是介绍系统的PATH环境变量已改,但是IDEA的Terminal环境变量为啥还是旧版本?,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

记录一次前端项目启动遇到的各种问题:

本项目做完,就更换项目了,但是更换项目后,需要重新搭建环境,启动项目的。
于是我这里又出幺蛾子了。
注意:我是 后端,后端,不是前端。。。啊啊啊啊啊啊阿

环境变量更换失败

按照项目项目所说使用node.js>17
在这里插入图片描述其实我问了一下小伙伴们,使用node >14,<16即可。
但是么,我这里使用的14.15.0就是跑不起来前端项目,逼得我更换node.js的版本。
于是我更换本地操作系统 环境变量后,出现问题了。
在这里插入图片描述
idea无论怎么弄,都还是旧版本。。。。fuck
我排查了半天,才发现是idea terminal的问题。
在这里插入图片描述
打开 idea:settings–>tools–>Terminal–>Environment variables–>打开环境变量窗口,找到 系统环境变量PATH
PATH在文档中打开,发现它引入的node.js还是旧的。
在这里插入图片描述
到最后,只能在上面添加自己的环境变量,来覆盖引入旧版本的path路径。。。

npm依赖解析失败
'Log files:
F:\node.js\node_cache\_logs\2023-12-11T02_27_04_229Z-debug-0.log# npm resolution error reportWhile resolving: vue-antd-jeecg@3.1.0
Found: eslint@5.16.0
node_modules/eslintdev eslint@"^5.16.0" from the root projectCould not resolve dependency:
peer eslint@"^7.5.0 || ^8.0.0" from @babel/eslint-parser@7.23.3
node_modules/@babel/eslint-parserdev @babel/eslint-parser@"^7.21.3" from the root projectFix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

本错误是依赖的问题,node给的提示其实很清楚的。下面命令二选一,推荐使用第二个:

 #强制安装。会无视冲突,并强制获取远端npm库资源,当有资源冲突时覆盖掉原先的版本。
npm install --force #安装时忽略所有peerDependencies,忽视依赖冲突,采用npm版本4到版本6的样式去安装依赖,已有的依赖不会覆盖。
npm install --legacy-peer-deps  
另外还有这个错误
---前面安装正确的日志省略
23895 warn mini-css-extract-plugin@2.6.1 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
23896 warn @babel/eslint-parser@7.23.3 requires a peer of eslint@^7.5.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
23897 verbose stack Error: EPERM: operation not permitted, rename 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'
23898 verbose cwd F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue
23899 verbose Windows_NT 10.0.19045
23900 verbose argv "F:\\node.js\\node-v14.21.3-win-x64\\node.exe" "F:\\node.js\\node-v14.21.3-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "install" "--registry=https://registry.npm.taobao.org"
23901 verbose node v14.21.3
23902 verbose npm  v6.14.18
23903 error code EPERM
23904 error syscall rename
23905 error path F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli
23906 error dest F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli
23907 error errno -4048------------------------------------------------------------
------注意这个地方哈。operation not permitted,操作不被允许
------------------------------------------------------------
23908 error Error: EPERM: operation not permitted, rename 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'
23908 error  [OperationalError: EPERM: operation not permitted, rename 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
23908 error   cause: [Error: EPERM: operation not permitted, rename 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'F:\idea_workspace_git\yd\new-energy\new-energy-power-production-management-vue\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
23908 error     errno: -4048,
23908 error     code: 'EPERM',
23908 error     syscall: 'rename',
23908 error     path: 'F:\\idea_workspace_git\\yd\\new-energy\\new-energy-power-production-management-vue\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
23908 error     dest: 'F:\\idea_workspace_git\\yd\\new-energy\\new-energy-power-production-management-vue\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli'
23908 error   },
23908 error   errno: -4048,
23908 error   code: 'EPERM',
23908 error   syscall: 'rename',
23908 error   path: 'F:\\idea_workspace_git\\yd\\new-energy\\new-energy-power-production-management-vue\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
23908 error   dest: 'F:\\idea_workspace_git\\yd\\new-energy\\new-energy-power-production-management-vue\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli',
23908 error   parent: 'npm'
23908 error }
------------------------------------------------------------
----- 还有这个地方的提示信息:你的操作系统拒绝了该操作。
------------------------------------------------------------
23909 error The operation was rejected by your operating system.
23909 error It's possible that the file was already in use (by a text editor or antivirus),
23909 error or that you lack permissions to access it.
23909 error
23909 error If you believe this might be a permissions issue, please double-check the
23909 error permissions of the file and its containing directories, or try running
23909 error the command again as root/Administrator.
23910 verbose exit [ -4048, true ]

这个问题我CSDN了好久,才明白啥意思,他的意思是你没权限,之前我一直纳闷,为啥不被允许。。。这个windows给文件夹加权就好了,具体的就不贴图了。
选中文件夹-->右击--->属性--->安全---->找到当前用户加权就好了。

如果加权不行,那就试试
删除C:\Users{账户}\下的.npmrc文件,然后执行npm cache clean --force (注意执行该命令,会让你的config设置变为初始化)

另外说一下:我更换node版本后(14.15.0->16.14.2)按照第一种方法解决了。
但是当我换回v14.15.0版本后按照两种方法都没成功。。。最后只能切换了node的版本。

关于install日志的寻找

一般来说node.js的日志都在你C:\windows\{currentUser}\Roamingl\npm-cache\_logs下,一般报错后会给提示日志位置的。

但是对于咱们来说特鸡儿方便。
使用以下命令可以修改日志位置:

#比如:我的日志我放到了这个目录下
#存放依赖
npm config set prefix "F:\node.js\node_global"
#存放缓存文件,比如:日志
npm config set cache "F:\node.js\node_cache"

一般你设置后,就能用使用npm config list看到
在这里插入图片描述
但是,注意:
使用以下命令,清除缓存后会失效,之后的配置都会重新放到C:\windows\{currentUser}\Roamingl\npm-cache\_logs

## 清理代理
npm config set proxy null
## 清理缓存
npm cache clean --force

这篇关于系统的PATH环境变量已改,但是IDEA的Terminal环境变量为啥还是旧版本?的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/481844

相关文章

IDEA编译报错“java: 常量字符串过长”的原因及解决方法

《IDEA编译报错“java:常量字符串过长”的原因及解决方法》今天在开发过程中,由于尝试将一个文件的Base64字符串设置为常量,结果导致IDEA编译的时候出现了如下报错java:常量字符串过长,... 目录一、问题描述二、问题原因2.1 理论角度2.2 源码角度三、解决方案解决方案①:StringBui

解决jupyterLab打开后出现Config option `template_path`not recognized by `ExporterCollapsibleHeadings`问题

《解决jupyterLab打开后出现Configoption`template_path`notrecognizedby`ExporterCollapsibleHeadings`问题》在Ju... 目录jupyterLab打开后出现“templandroidate_path”相关问题这是 tensorflo

在不同系统间迁移Python程序的方法与教程

《在不同系统间迁移Python程序的方法与教程》本文介绍了几种将Windows上编写的Python程序迁移到Linux服务器上的方法,包括使用虚拟环境和依赖冻结、容器化技术(如Docker)、使用An... 目录使用虚拟环境和依赖冻结1. 创建虚拟环境2. 冻结依赖使用容器化技术(如 docker)1. 创

Idea实现接口的方法上无法添加@Override注解的解决方案

《Idea实现接口的方法上无法添加@Override注解的解决方案》文章介绍了在IDEA中实现接口方法时无法添加@Override注解的问题及其解决方法,主要步骤包括更改项目结构中的Languagel... 目录Idea实现接China编程口的方法上无法添加@javascriptOverride注解错误原因解决方

CentOS系统Maven安装教程分享

《CentOS系统Maven安装教程分享》本文介绍了如何在CentOS系统中安装Maven,并提供了一个简单的实际应用案例,安装Maven需要先安装Java和设置环境变量,Maven可以自动管理项目的... 目录准备工作下载并安装Maven常见问题及解决方法实际应用案例总结Maven是一个流行的项目管理工具

Linux环境变量&&进程地址空间详解

《Linux环境变量&&进程地址空间详解》本文介绍了Linux环境变量、命令行参数、进程地址空间以及Linux内核进程调度队列的相关知识,环境变量是系统运行环境的参数,命令行参数用于传递给程序的参数,... 目录一、初步认识环境变量1.1常见的环境变量1.2环境变量的基本概念二、命令行参数2.1通过命令编程

在idea中使用mysql数据库超详细教程

《在idea中使用mysql数据库超详细教程》:本文主要介绍如何在IntelliJIDEA中连接MySQL数据库,并使用控制台执行SQL语句,还详细讲解了如何使用MyBatisGenerator快... 目录一、连接mysql二、使用mysql三、快速生成实体、接口、sql文件总结一、连接mysql在ID

IDEA如何让控制台自动换行

《IDEA如何让控制台自动换行》本文介绍了如何在IDEA中设置控制台自动换行,具体步骤为:File-Settings-Editor-General-Console,然后勾选Usesoftwrapsin... 目录IDEA如何让控制台自http://www.chinasem.cn动换行操作流http://www

解读静态资源访问static-locations和static-path-pattern

《解读静态资源访问static-locations和static-path-pattern》本文主要介绍了SpringBoot中静态资源的配置和访问方式,包括静态资源的默认前缀、默认地址、目录结构、访... 目录静态资源访问static-locations和static-path-pattern静态资源配置

IDEA运行spring项目时,控制台未出现的解决方案

《IDEA运行spring项目时,控制台未出现的解决方案》文章总结了在使用IDEA运行代码时,控制台未出现的问题和解决方案,问题可能是由于点击图标或重启IDEA后控制台仍未显示,解决方案提供了解决方法... 目录问题分析解决方案总结问题js使用IDEA,点击运行按钮,运行结束,但控制台未出现http://