在'react / redux'应用中获取'bundle.js:1 Uncaught SyntaxError:Unexpected token'<'

时间:2019-10-12 20:33:23

标签: redux react-redux

我正在尝试从Wes Bos的网站上学习redux:https://courses.wesbos.com/account,并且正在尝试在他的课程中关注他。但是,即使完全按照他在屏幕上显示的内容显示,也会出现错误。我有2个文件-Main.js和reduxstagram.js。我的Main.js如下:

    import React from 'react';
    import { Link } from 'react-router';

    const Main = React.createClass({
      render(){
         return(
            <div>
             <h1>
                <Link to="/">Reduxstagram</Link>
            </h1>
           </div>
         )
        }
       })

     export default Main;

我的reduxstagram.js如下:

    // let's go!
    import React from 'react';
    import { render } from 'react-dom';

     //import css
     import css from './styles/style.styl';

      //import components
      import Main from './components/Main';

      render(<Main/>, document.getElementById('root'));

但是当我尝试使用“ npm start”呈现页面时,出现以下错误:

     bundle.js:1 Uncaught SyntaxError: Unexpected token '<' in 
     react/redux app

控制台出现以下错误:

     ERROR in ./components/Main.js
    Module parse failed: /Users/myUser/Downloads/Learn-Redux-Starter- 
     Files-master/learn-redux/components/Main.js Unexpected token 
       (7:12)
       You may need an appropriate loader to handle this file type.
        SyntaxError: Unexpected token (7:12)
        at Parser.pp$4.raise (/Users/myUser/Downloads/Learn-Redux- 
          Starter-Files-master/learn- 


  redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/myUser/Downloads/Learn-Redux- 
        Starter-Files-master/learn- 

  redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:603:10)
  at Parser.pp$3.parseExprAtom (/Users/myUser/Downloads/Learn-Redux- 
       Starter-Files-master/learn- 

 redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1822:12)
     at Parser.pp$3.parseExprSubscripts 
   (/Users/myUser/Downloads/Learn-Redux-Starter-Files-master/learn- 
   redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1715:21)
     at Parser.pp$3.parseMaybeUnary 
     (/Users/myUser/Downloads/Learn-Redux-Starter-Files-master/learn- 

   redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1692:19)
        at Parser.pp$3.parseExprOps 
      (/Users/myUser/Downloads/Learn-Redux-Starter-Files-master/learn- 


  redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1637:21)
      at Parser.pp$3.parseMaybeConditional 
   (/Users/myUser/Downloads/Learn-Redux-Starter-Files-master/learn- 
   redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/myUser/Downloads/Learn- 
    Redux-Starter-Files-master/learn- 
   redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1597:21)
  at Parser.pp$3.parseParenAndDistinguishExpression 
    (/Users/myUser/Downloads/Learn-Redux-Starter-Files-master/learn- 
   redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1861:32)
  at Parser.pp$3.parseExprAtom (/Users/myUser/Downloads/Learn-Redux- 
   Starter-Files-master/learn- 

   redux/node_modules/webpack/node_modules/acorn/dist/acorn.js:1796:19)
   @ ./client/reduxstagram.js 13:12-41

有人可以指出我所缺少的吗?

0 个答案:

没有答案