运行以下并选择所有默认选项,但无法在浏览器中访问该应用程序。
react-static create
? What should we name this project? my-first-site
? Select a template below... typescript
Creating new react-static project...
然后我cd
到新生成的项目目录并准备部署。
yarn start
我得到了一些不错的输出
yarn run v1.22.10
$ react-static start
Starting Development Server...
Fetching Site Data...
[✓] Site Data Downloaded
Building Routes...
Importing routes from directory...
{ has404: true }
[✓] Routes Built (0.1s)
Building Templates...
[✓] Templates Built
Bundling Application...
Fetching Site Data...
[✓] Site Data Downloaded (0.1s)
Running plugins...
[✓] Application Bundled (15.9s)
[✓] App serving at http://localhost:3000
然后失败:
使用 npm 而不是 yarn 构建服务会在我的网络上打开该站点,但在本地主机主机上它仍然无法运行。
npm run build
npm run serve