3

どんな情報でも本当に役に立ちます。最初に npm install babel-loader コマンドも実行しました。

私は持っている

./app-client.js モジュールのビルドのエラー: SyntaxError: /Users/dawatramani/ReactNodejs/app-client.js:

予期しないトークン (4:13)

  2 | var APP= require('./components/APP');
  3 | 
> 4 | React.render(<APP />,document.getElementById('react-container'));
    |              ^
  5 | 

Parser.pp.raise (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:22:13) で Parser.pp.unexpected (/Users/dawatramani/ReactNodejs/ node_modules/babel-core/node_modules/babylon/lib/parser/util.js:89:8) の Parser.pp.parseExprAtom (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/) expression.js:522:12) の Parser.pp.parseExprSubscripts (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:277:19) の Parser.pp.parseMaybeUnary (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:257:19) Parser.pp.parseExprOps (/Users/dawatramani/ReactNodejs/node_modules/babel-core/) node_modules/babylon/lib/parser/expression.js:188:19) Parser.pp で。parseMaybeConditional (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:165:19) の Parser.pp.parseMaybeAssign (/Users/dawatramani/ReactNodejs/node_modules/babel-core) /node_modules/babylon/lib/parser/expression.js:128:19) Parser.pp.parseExprListItem (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:1046) で:16) Parser.pp.parseCallExpressionArguments (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:353:20) で Parser.pp.parseSubscripts (/Users/dawatramani) で/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:316:31) Parser.pp で。parseExprSubscripts (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:287:15) の Parser.pp.parseMaybeUnary (/Users/dawatramani/ReactNodejs/node_modules/babel-core) /node_modules/babylon/lib/parser/expression.js:257:19) で Parser.pp.parseExprOps (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:188) :19) Parser.pp.parseMaybeConditional (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:165:19) で Parser.pp.parseMaybeAssign (/Users/dawatramani) で/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:128:19) の Parser.pp.parseExpression (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib) /parser/expression.js:92:19) Parser.pp.parseStatement (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:163:19) で Parser.pp.parseBlockBody (/Users/dawatramani/ ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:529:21) の Parser.pp.parseTopLevel (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/) parser/statement.js:36:8) で Parser.parse (/Users/dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/parser/index.js:129:19) で parse (/Users/ dawatramani/ReactNodejs/node_modules/babel-core/node_modules/babylon/lib/index.js:47:47) の File.parse (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation/file/index. js:517:34) ファイルで。/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation/pipeline.js の parseCode (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation/file/index.js:603:20) :49:12 の File.wrap (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation/file/index.js:563:16) の Pipeline.transform (/Users/dawatramani/ReactNodejs/node_modules/)オブジェクト.module.exports (/Users/ダワトラマニ/ReactNodejs/node_modules/babel-loader/index.js:88:12)Pipeline.transform (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation) でラップ (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation/file/index.js:563:16) /pipeline.js:47:17) トランスパイル (/Users/dawatramani/ReactNodejs/node_modules/babel-loader/index.js:14:22) で Object.module.exports (/Users/dawatramani/ReactNodejs/node_modules/babel) -loader/index.js:88:12)Pipeline.transform (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation) でラップ (/Users/dawatramani/ReactNodejs/node_modules/babel-core/lib/transformation/file/index.js:563:16) /pipeline.js:47:17) トランスパイル (/Users/dawatramani/ReactNodejs/node_modules/babel-loader/index.js:14:22) で Object.module.exports (/Users/dawatramani/ReactNodejs/node_modules/babel) -loader/index.js:88:12)

4

2 に答える 2

0

コンポーネントをrenderメソッドに貼り付けるのを忘れたようです:)

React.render(,document.getElementById('react-container'));
于 2016-07-21T06:09:56.407 に答える