代码之家  ›  专栏  ›  技术社区  ›  C Sharper

React Js:没有这样的文件或目录,打开包.json

  •  0
  • C Sharper  · 技术社区  · 4 年前

    PS D:\React\operations\u 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
    

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

    enter image description here

    参考项目结构-

    enter image description here

    我参考了几个网站,再次运行-npm安装 但同样的错误依然存在。

    2 回复  |  直到 4 年前
        1
  •  2
  •   Nitin Dev    4 年前

    你在跑步 npm start

    移动到 D:\React\operations_app_tut\operations_app_tut 那就跑吧 npm启动

        2
  •  0
  •   C Sharper    4 年前

    我的错误是,我有一个文件夹 D:/React 我手动创建的- operations_app_tut D: 反应

    在这之后,我通过可视代码通过路径打开它:- D:/React/operations_app_tut

    npx create-react-app operations_app_tut
    

    此命令在中创建了另一个文件夹 使我的项目路径- D:/React/operations_app_tut/operations_app_tut

    因为我用路径在终端上运行npm start- D: /反应/操作

    教训-

    1. 不要手动创建项目文件夹,它将通过自动创建 npx create-react-app