我用生成-反应-服务器创建了一个简单的项目。一切都很好。
我刚刚为home.js创建了新的路由、新的页面和新的组件,并更改了hello-world.js (页面和组件)。
现在,当运行npm start或react-server start时,服务器在没有返回任何特定错误的情况下关闭,但返回以下日志(注意,它在以前工作时已经记录了相同的消息)。
2016-10-21T15:44:01.071Z - warning: [react-server-cli.src.logProductionWarnings] PRODUCTION WARNING: the following current settings are discouraged in production environments. (If you are developing, carry on!):
2016-10-21T15:44:01.075Z - warning: [react-server-cli.src.logProductionWarnings] -- Minification is disabled. To enable, set minify to true (--minify at the command-line) or set NODE_ENV=production.
2016-10-21T15:44:01.076Z - warning: [react-server-cli.src.logProductionWarnings] -- Long-term caching is disabled. To enable, set longTermCaching to true (--long-term-caching at the command-line) or set NODE_ENV=production to turn on.
2016-10-21T15:44:01.076Z - info: [react-server-cli.src.logProductionWarnings] NODE_ENV is set to undefined发布于 2016-10-21 22:54:47
问题是routes.js中定义的路由仍然指向一个不再存在的页面(page属性)。路线无法解决。
routes.js:
{
"middleware": [],
"routes": {
"Homepage": {
"path": "/",
"page": "pages/home.js"
}
}发布于 2016-10-21 19:15:48
你好,先生,您必须按照以下步骤运行您的代码
安装约曼
npm安装-g yo
安装react server生成器
npm安装-g生成器-
在当前目录中创建一个新的react server项目。
yo react服务器
运行新的应用程序
npm运行启动
转到http://localhost:3000
https://stackoverflow.com/questions/40181035
复制相似问题