首页 > 解决方案 > React Js:没有这样的文件或目录,打开 Package.json

问题描述

在运行 npm start 时,我收到错误 -

PS D:\React\operations_app_tut> npm start

npm ERR! path D:\React\operations_app_tut\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'D:\React\operations_app_tut\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:\Users\IT-DI\AppData\Roaming\npm-cache\_logs\2020-12-16T05_56_02_304Z-debug.log

在检查物理路径时确保文件存在 -

在此处输入图像描述

参考项目的结构 -

在此处输入图像描述

我参考了几个站点并再次运行 -npm install 但同样的错误仍然存​​在。

标签: javascriptreactjsnpmpackage.json

解决方案


npm start在不正确的文件夹中运行。还有为什么外面有 package-lock.json。

移动到D:\React\operations_app_tut\operations_app_tut目录然后运行npm start


推荐阅读