我想在ec2实例上运行一个简单的react / falcon网站,但我遇到了一些麻烦。我怀疑问题在于将公众面向实例的网址指向该网站的登陆/主页但我不完全确定。
我已为实例配置了入站规则,以允许所有传入的http和https流量,因此我认为这不是权限问题。
我觉得我需要在package.json中添加一些内容才能使其正常工作。
当我运行npm时,启动以下输出:
编译成功! 您现在可以在浏览器中查看sapie-fe。 本地:http://localhost:3000/ 在您的网络上:http://172.31.26.109:3000/
请注意,开发版本未进行优化。 要创建生产版本,请使用npm run build。 当我在浏览器中访问http://172.31.26.109:3000/时,没有任何事情发生/加载。 package.json看起来像这样:
{
"name": "sapie-fe",
"version": "0.1.0",
"homepage": ".",
"private": true,
"dependencies": {
"amazon-cognito-identity-js": "^1.31.0",
"axios": "0.17.1",
"classnames": "^2.2.5",
"object-path": "^0.11.4",
"react": "^16.2.0",
"react-bootstrap": "^0.32.1",
"react-dom": "^16.2.0",
"react-rebind": "^0.1.9",
"react-router": "^4.2.0",
"react-router-bootstrap": "^0.24.4",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.17",
"react-stripe-checkout": "^2.6.3",
"stripe": "^5.4.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {}
}
我想我应该在这里添加一些内容以使其工作但不确定。 npm install产生以下结果:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN react-lorem-component@0.12.2 requires a peer of react@15.x but none was installed.
这些似乎可能是线索,但只是警告,而且他们脸上似乎与公众面向网址无法访问我的网站无关。
非常感谢任何帮助
答案 0 :(得分:1)
必须打开端口3000到所有传入的连接,它工作。卫生署!