启动Meteor应用程序时出错(static-html)

问题描述 投票:0回答:1

我有一个运行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.

我非常感谢您的帮助

javascript html npm meteor
1个回答
0
投票

您需要reactreact-dom来渲染反应组件

meteor npm install --save react react-dom

您需要删除blaze,然后再添加static-htmlstatic-html用于呈现init html元素,然后react可以从那里接管。

meteor remove blaze-html-templates
meteor add static-html

React流星指南https://guide.meteor.com/react.html

© www.soinside.com 2019 - 2024. All rights reserved.