令牌错误"/>
npm启动时发生意外的令牌错误
刚尝试创建我的第一个React应用程序,然后在网上找到了该教程: http : //jmfurlott/tutorial-setting-up-a-single-page-react-web-app-with-react-router-and-webpack / 。 但是,完成后我遇到了一个问题。 在命令行中执行“ npm start”时,我不断收到此错误:
Module build failed: SyntaxError: /Users/ryan.garrett/Documents/myExample/js/app.js: Unexpected token (10:6)
在第10行发现错误:
<div className="nav">
完整的版本是这样的:
import React from 'react';
import Router from 'react-router';
import { DefaultRoute, Link, Route, RouteHandler } from 'react-router';
import LoginHandler from './components/Login.js';
let App = React.createClass({
render: function() {
return (
<div className="nav">
<Link to="app">Home</Link>
<Link to="login">Login</Link>
{/* this is the importTant part */}
<RouteHandler/>
</div>
);
}
});
let routes = (
<Route name="app" path="/" handler={App}>
<Route name="login" path="/login" handler={LoginHandler}/>
</Route>
);
Router.run(routes, function (Handler) {
React.render(<Handler/>, document.body);
});
回答如下:
更多推荐
npm启动时发生意外的令牌错误
发布评论