系统的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/481846

相关文章

golang程序打包成脚本部署到Linux系统方式

《golang程序打包成脚本部署到Linux系统方式》Golang程序通过本地编译(设置GOOS为linux生成无后缀二进制文件),上传至Linux服务器后赋权执行,使用nohup命令实现后台运行,完... 目录本地编译golang程序上传Golang二进制文件到linux服务器总结本地编译Golang程序

Linux系统性能检测命令详解

《Linux系统性能检测命令详解》本文介绍了Linux系统常用的监控命令(如top、vmstat、iostat、htop等)及其参数功能,涵盖进程状态、内存使用、磁盘I/O、系统负载等多维度资源监控,... 目录toppsuptimevmstatIOStatiotopslabtophtopdstatnmon

IDEA中新建/切换Git分支的实现步骤

《IDEA中新建/切换Git分支的实现步骤》本文主要介绍了IDEA中新建/切换Git分支的实现步骤,通过菜单创建新分支并选择是否切换,创建后在Git详情或右键Checkout中切换分支,感兴趣的可以了... 前提:项目已被Git托管1、点击上方栏Git->NewBrancjsh...2、输入新的分支的

IDEA Maven提示:未解析的依赖项的问题及解决

《IDEAMaven提示:未解析的依赖项的问题及解决》:本文主要介绍IDEAMaven提示:未解析的依赖项的问题及解决,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝... 目录IDEA Maven提示:未解析的依编程赖项例如总结IDEA Maven提示:未解析的依赖项例如

怎么用idea创建一个SpringBoot项目

《怎么用idea创建一个SpringBoot项目》本文介绍了在IDEA中创建SpringBoot项目的步骤,包括环境准备(JDK1.8+、Maven3.2.5+)、使用SpringInitializr... 目录如何在idea中创建一个SpringBoot项目环境准备1.1打开IDEA,点击New新建一个项

linux重启命令有哪些? 7个实用的Linux系统重启命令汇总

《linux重启命令有哪些?7个实用的Linux系统重启命令汇总》Linux系统提供了多种重启命令,常用的包括shutdown-r、reboot、init6等,不同命令适用于不同场景,本文将详细... 在管理和维护 linux 服务器时,完成系统更新、故障排查或日常维护后,重启系统往往是必不可少的步骤。本文

Mac系统下卸载JAVA和JDK的步骤

《Mac系统下卸载JAVA和JDK的步骤》JDK是Java语言的软件开发工具包,它提供了开发和运行Java应用程序所需的工具、库和资源,:本文主要介绍Mac系统下卸载JAVA和JDK的相关资料,需... 目录1. 卸载系统自带的 Java 版本检查当前 Java 版本通过命令卸载系统 Java2. 卸载自定

一文详解如何在idea中快速搭建一个Spring Boot项目

《一文详解如何在idea中快速搭建一个SpringBoot项目》IntelliJIDEA作为Java开发者的‌首选IDE‌,深度集成SpringBoot支持,可一键生成项目骨架、智能配置依赖,这篇文... 目录前言1、创建项目名称2、勾选需要的依赖3、在setting中检查maven4、编写数据源5、开启热

基于Python实现一个简单的题库与在线考试系统

《基于Python实现一个简单的题库与在线考试系统》在当今信息化教育时代,在线学习与考试系统已成为教育技术领域的重要组成部分,本文就来介绍一下如何使用Python和PyQt5框架开发一个名为白泽题库系... 目录概述功能特点界面展示系统架构设计类结构图Excel题库填写格式模板题库题目填写格式表核心数据结构

详解Linux中常见环境变量的特点与设置

《详解Linux中常见环境变量的特点与设置》环境变量是操作系统和用户设置的一些动态键值对,为运行的程序提供配置信息,理解环境变量对于系统管理、软件开发都很重要,下面小编就为大家详细介绍一下吧... 目录前言一、环境变量的概念二、常见的环境变量三、环境变量特点及其相关指令3.1 环境变量的全局性3.2、环境变