npm ERR! code ENOENT npm ERR! syscall open npm ERR! path C:\Users\shuzi\Desktop\保密文件项目\test-ui/package.json npm ERR! errno -4058

打开一个新的项目,因为当前项目文件夹下没有npm,"dev": "npm run start:dev",所以所以没有展示对应的运行图,如下图:

 

打开一个新的前端项目,执行npm install, 报错如图:

Windows PowerShell
版权所有(C) Microsoft Corporation。保留所有权利。

安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows

PS C:\Users\shuzi\Desktop\保密文件项目\test-ui> npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\shuzi\Desktop\保密文件项目\test-ui/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\shuzi\Desktop\保密文件项目\test-ui\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!     C:\Program Files\nodejs\node_cache\_logs\2024-01-18T06_00_40_960Z-debug-0.log
PS C:\Users\shuzi\Desktop\保密文件项目\test-ui>

原因为我这个是解压缩过来的项目文件,IDEA打开的是上层目录,C:\Users\shuzi\Desktop\保密文件项目\test-ui\,而下面还有一层目录test-ui,所以才找不到文件,应该在最下层test-ui这个地方打开才可以。

这样一来,npm已经安装,就不用再次执行npm install,直接执行 npm run dev即可

posted @ 2024-01-18 14:35  封狼居胥_神都  阅读(258)  评论(0编辑  收藏  举报