解决npm ERR! code ENOENT npm ERR! syscall open npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/pack

文章讲述了用户在执行npm命令时遇到的错误,原因是找不到package.json文件。问题在于执行命令的目录不正确。解决方法是找到正确的package.json文件路径,然后在终端使用该路径进行npm操作,如`npminstall`或`npmrundev`即可解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

执行npm命令报错:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'X:\RuoYi-Vue-master\RuoYi-Vue-master\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

被自己蠢哭了,问题原因: 报错中已经说了 在xxxl路径下找不到 package.json文件,所以罪魁祸首就是执行npm命令的目录不对。
解决办法: 找到 package.json正确的目录,然后再在终端执行npm命令即可。

以自己为例,实际的路径如下:
在这里插入图片描述
然后用这个路径在终端执行npm install 或npm run dev 都正常了:

在这里插入图片描述

在这里插入图片描述

Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.5.3/maven-release-plugin-2.5.3.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.5.3/maven-release-plugin-2.5.3.pom (11 kB at 1.0 MB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/release/maven-release/2.5.3/maven-release-2.5.3.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/release/maven-release/2.5.3/maven-release-2.5.3.pom (5.0 kB at 502 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/27/maven-parent-27.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/27/maven-parent-27.pom (41 kB at 3.7 MB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/17/apache-17.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/17/apache-17.pom (16 kB at 1.5 MB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.5.3/maven-release-plugin-2.5.3.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.5.3/maven-release-plugin-2.5.3.jar (53 kB at 4.1 MB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 1.3 MB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (21 kB at 764 kB/s) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.954 s [INFO] Finished at: 2025-07-09T06:18:06Z [INFO] ------------------------------------------------------------------------ [ERROR] No plugin found for prefix 'spring-boot' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/root/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException root@srv771551:~/jeecg-boot# cd ../jeecgboot-vue3 -bash: cd: ../jeecgboot-vue3: No such file or directory root@srv771551:~/jeecg-boot# npm install npm run dev npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /root/jeecg-boot/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/root/jeecg-boot/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2025-07-09T06_18_32_236Z-debug-0.log npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /root/jeecg-boot/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/root/jeecg-boot/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2025-07-09T06_18_34_357Z-debug-0.log root@srv771551:~/jeecg-boot#
最新发布
07-10
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值