[英]React Js : no such file or directory, open Package.json
While running npm start, I am getting error -在运行 npm 启动时,我收到错误 -
PS D:\React\operations_app_tut> npm start PS D:\React\operations_app_tut> npm 开始
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
While checking physical path made sure file exists -在检查物理路径时确保文件存在 -
Structure Of Project For Ref -参考项目的结构 -
I referred few sites and again ran -npm install But same error persisted.我参考了几个站点并再次运行 -npm install 但同样的错误仍然存在。
You are running npm start
in incorrect folder.Also why there is package-lock.json outside.您在错误的文件夹中运行
npm start
。还有为什么外面有 package-lock.json。
move to D:\React\operations_app_tut\operations_app_tut
directory then run npm start
移动到
D:\React\operations_app_tut\operations_app_tut
目录然后运行npm start
Thanks @NitinDev And @Adithya.谢谢@NitinDev 和@Adithya。
Adding details if future contributor faces the same issue -如果未来的贡献者面临同样的问题,请添加详细信息 -
My mistake here was, I had a folder D:/React
Within this folder I had all my react projects.我的错误是,我有一个文件夹
D:/React
在这个文件夹中我有我所有的反应项目。 I manually created - operations_app_tut
folder in D:/React
我在
D:/React
中手动创建了operations_app_tut
文件夹
After this I opened it through Visual Code via path:- D:/React/operations_app_tut
and ran command -在此之后,我通过 Visual Code 通过路径打开它:-
D:/React/operations_app_tut
并运行命令 -
npx create-react-app operations_app_tut
This command created another folder within operations_app_tut
which made my project path to be - D:/React/operations_app_tut/operations_app_tut
此命令在
operations_app_tut
中创建了另一个文件夹,这使我的项目路径为 - D:/React/operations_app_tut/operations_app_tut
Since I was running npm start on terminal with path - D:/React/operations_app_tut
which was not the actual path, it was giving me error.由于我在终端上运行 npm 启动路径 -
D:/React/operations_app_tut
这不是实际路径,因此它给了我错误。
Lesson -课程 -
npx create-react-app
npx create-react-app
自动创建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.