npm启动时发生意外的令牌错误

编程入门 行业动态 更新时间:2024-10-09 17:27:01

npm启动时发生意外的<a href=https://www.elefans.com/category/jswz/34/1771317.html style=令牌错误"/>

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启动时发生意外的令牌错误

本文发布于:2024-05-06 19:40:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1753745.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   启动时   发生意外   错误   npm

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!