When writing a react server rendering chestnuts, there was an exception thrown by nodemon compiler server.jsx?

  node.js, question


Json file

“scripts”: {

"test": "webpack-dev-server --hot",
 "server":"nodemon server.jsx --exec babel-node"


The specific code is

import express from 'express'
 import React from 'react'
 import { renderToString } from 'react-dom/server'
 import {RoutingContext,match} from 'react-router'
 import {Provider} from 'react-redux'
 import * as test from '../../actions/test/testaction'
 import routes from './routes'
 import configureStore from './stores/index.js'
 const app=express()
 function renderFullPage(html,initialState){
 return (`
 <!  DOCTYPE html>
 <html lang="en">
 <meta charset="UTF-8" />
 <div id="app">
 window.__INITIAL_STATE__ = ${JSON.stringify(initialState)};
 <script src="index.js"></script>
 app.use((req, res) => {
 match({ routes, location: req.url }, (err, redirectLocation, renderProps) => {
 if (err) {
 res.status(500).end(`Internal Server Error ${err}`);
 } else if (redirectLocation) {
 Res.redirect (redirect location.pathname plus redirectLocation.search);
 } else if (renderProps) {
 const store = configureStore();
 const state = store.getState();
 store.dispatch(test.getTestDate())     //store.dispatch(fetchItem(renderProps.params.id))
 .then(() => {
 const html = renderToString(
 <Provider store={store}>
 <RoutingContext {...renderProps} />
 res.end(renderFullPage(html, store.getState()));
 } else {
 res.status(404).end('Not found');

This is a chestnut that I wrote according to the tutorial, but I don’t know why this mistake occurred.

Visual inspection is lackingbabel-preset-react, check.babelrcRight.