我有一个运行Meteor框架+ React的应用程序。我正在尝试使用npm start
命令启动该应用,但我一直在获取有关static-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