Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何为React应用程序配置Google应用程序引擎nodejs8标准环境?_Node.js_Reactjs_Google App Engine_Google Cloud Platform - Fatal编程技术网

Node.js 如何为React应用程序配置Google应用程序引擎nodejs8标准环境?

Node.js 如何为React应用程序配置Google应用程序引擎nodejs8标准环境?,node.js,reactjs,google-app-engine,google-cloud-platform,Node.js,Reactjs,Google App Engine,Google Cloud Platform,我使用React和Node.js 8为Google app Engine开发了一个简单的应用程序。它在灵活的环境中工作得很好,但是如果我尝试在标准环境中部署它,就会出现“GET/HTTP/1.1”500个错误。除此之外,我再也找不到更多关于问题所在的信息了 如何配置它,使其在标准环境中工作 app.standard.yaml runtime: nodejs8 handlers: - url: / script: src/index.js - url: /src scri

我使用React和Node.js 8为Google app Engine开发了一个简单的应用程序。它在灵活的环境中工作得很好,但是如果我尝试在标准环境中部署它,就会出现“GET/HTTP/1.1”500个错误。除此之外,我再也找不到更多关于问题所在的信息了

如何配置它,使其在标准环境中工作

app.standard.yaml

runtime: nodejs8

handlers:
  - url: /
    script: src/index.js
  - url: /src
    script: index.js
package.json

{
  "name": "eventpub",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "8.x.x"
  },
  "dependencies": {
    "node-pre-gyp": "^0.11.0",
    "npm": "^5.6.0",
    "react": "^16.4.2",
    "react-collapsible": "^2.3.1",
    "react-dom": "^16.4.2",
    "react-json-viewer": "^1.7.1",
    "react-scripts": "1.1.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
项目文件夹结构

node_modules
public
- public/index.html
- public/manifest.json
src
- src/App.css
- src/App.js
- src/App.test.js
- src/index.css
- src/index.js
- src/registerServiceWorker.js
.gcloudignore
.gitignore
app.flexible.yaml
app.standard.yaml
package.json
package-lock.json
README.md

在我看来,您遇到的问题似乎是由于Nodejs的应用程序引擎标准仍处于beta测试阶段,正如在

中所述,我通过先构建react应用程序(npm运行构建),将已构建的版本部署到google cloud,然后在App.yaml中为已构建的应用程序添加处理程序来解决这个问题

handlers:
- url: /
  static_files: build/index.html
  upload: build/index.html
- url: /
  static_dir: build