javascript - 启动 Meteor 应用程序时出错 + react (static-html)
问题描述
我有一个使用 Meteor 框架 + React 运行的应用程序。我正在尝试使用npm start
命令启动应用程序,但我不断收到有关静态 html 文件的这些错误。我对流星很陌生,所以我尝试在下面运行这些命令:
meteor remove static-html
meteor add blaze-html-templates
但我仍然遇到同样的错误......
=> Errors prevented startup:
While processing files with static-html (for target web.browser):
deploy/bundle/programs/web.browser/body.html:1: Expected one of: <body>, <head>, <template>
deploy/bundle/programs/web.browser/head.html:1: Expected one of: <body>, <head>, <template>
deploy/bundle/programs/web.browser.legacy/body.html:1: Expected one of: <body>, <head>, <template>
deploy/bundle/programs/web.browser.legacy/head.html:1: Expected one of: <body>, <head>, <template>
While processing files with static-html (for target web.browser.legacy):
deploy/bundle/programs/web.browser/body.html:1: Expected one of: <body>, <head>, <template>
deploy/bundle/programs/web.browser/head.html:1: Expected one of: <body>, <head>, <template>
deploy/bundle/programs/web.browser.legacy/body.html:1: Expected one of: <body>, <head>, <template>
deploy/bundle/programs/web.browser.legacy/head.html:1: Expected one of: <body>, <head>, <template>
=> Your application has errors. Waiting for file change.
我很感激任何帮助
解决方案
您需要react
并react-dom
渲染反应组件
meteor npm install --save react react-dom
您需要删除blaze
添加添加static-html
回来。static-html
用于渲染 init html 元素,然后react
可以从那里接管。
meteor remove blaze-html-templates
meteor add static-html
React 流星指南 https://guide.meteor.com/react.html
推荐阅读
- react-native - 为 Facebook 应用审查创建一个模拟器构建。(不存在捆绑 URL)
- c# - 如何使用 C# 从包含大量其他文件或文件夹的文件夹中正确删除 .Net Core 中的文件
- python - 导入模块时是否可以创建符号链接或快捷方式?
- android - 使用导航、片段工厂和 Dagger 2 时尝试将 navGraph 与 NavHostFragment 关联时出现 Stackoverflow 错误?
- jquery - jQuery - 具有不同元素的相同函数()
- angular - '未捕获的 HttpErrorResponse' Jasmine 测试失败
- python - 使用 exec 和返回结果从 golang 内联 python3
- excel - 将单元格向左移动而不影响其自己的列
- raspberry-pi - 从 Raspberry pi 的源代码构建 Linphone
- python - Python 错误:“TypeError:'int' 对象不可调用