0

好的,标题可能令人困惑,但我认为我的问题很容易用终端代码来解释。我的问题在代码墙下方。强调文本

[fsevents] Success: "/Users/Name/my-app/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
+ react-dom@16.6.3
+ react-scripts@2.1.1
+ react@16.6.3
added 1768 packages from 678 contributors and audited 35639 packages in 81.268s
found 0 vulnerabilities


Initialized a git repository.

Success! Created my-app at /Users/macbookpro/my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd my-app
  npm start

那么,我如何安全地终止它,然后重新打开它?或者它是否需要保持运行,如果它被终止,是否需要使用“npx create-react app”命令重新安装?

我想我只是想知道如何访问“那个目录”。

我知道这可能是一个超级基本的问题,但它会帮助我掌握管理我的 React 应用程序。

谢谢!!

4

3 回答 3

2

终止并重新打开

您可以使用 CTRL + C 或 CTRL + Z 终止项目。终止后,您可以随意重新启动它。假设您的项目在端口 3000 上运行,如果您终端项目,您将无法在浏览器中获取您的项目。

如果你想让你的项目像http://localhost:3000一样,你需要让项目保持运行。

npx 命令

无需再次“npx create-react app”。“npx create-react-app my-app” 命令将全局安装 create-react-app 命令,但暂时只有在初始项目时才需要它。

访问“那个目录”

我认为您在上面发布的消息已经告诉了您。

我们建议您首先键入:

 cd my-app

 npm start
于 2018-11-24T15:36:18.043 回答
0

实际上安装完成后,您不需要终止它。

要进入项目目录,只需键入cd my-app

然后启动开发服务器类型npm start 需要几秒钟才能将您带到浏览器(打开我的应用项目)。

您可能希望看到浏览器的地址栏来了解开发服务器的运行端口。

当您需要停止服务器时,只需按ctrl + c

如果您忘记了项目目录在 mac 中的位置,您可以通过以下方式找到mdfind kind:folder "my-app"

可选:如果您使用Visual Studio Code,那么您可以在项目目录中键入code .being,以使用 VS Code 打开完整的项目目录。

于 2020-10-02T13:53:47.880 回答
0

如果您选择npm start,则观察者将持续运行以进行开发过程。您可以在终端上按两次 CTRL + C 停止它。

npm run build 运行一次并停止单独生成用于生产的文件(编译,缩小)。

于 2018-11-24T14:57:01.330 回答