【问题标题】:Get a bunch of errors when trying to run "npm start" after running "create-react-app my-app"运行“create-react-app my-app”后尝试运行“npm start”时出现一堆错误
【发布时间】:2020-11-04 10:44:10
【问题描述】:

在终端中运行“create-react-app my-app”后尝试运行“npm start”时出现一堆错误。它似乎涉及一个 packages.json 文件,但我已经完全卸载了 node.js 并再次安装它,但仍然遇到同样的问题。错误:

npm ERR! syscall open
npm ERR! path /Users/marcel/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/marcel/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!     /Users/marcel/.npm/_logs/2020-07-15T01_33_47_980ZMarcelMarcels-MacBook-PrMarcels-MacBook

【问题讨论】:

  • 哎呀。是的,就是这样,我使用了 cmets 中的这段代码:``$ npm install -g express```
  • 这似乎不是 Express 的问题
  • 你是否在项目目录中打开终端。在运行 create-react-app my-app 之后运行 cd my-app 然后运行 ​​npm i, npm start

标签: node.js reactjs terminal


【解决方案1】:

在使用npm之前,你需要进入你的React应用的目录,里面会有一个packag.json

示例

npx create-react-app my-app
cd my-app
npm start

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-17
    • 2020-09-23
    • 2019-06-11
    • 1970-01-01
    • 1970-01-01
    • 2018-12-04
    • 2021-10-02
    • 1970-01-01
    相关资源
    最近更新 更多