question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can not run - unexpected token

See original GitHub issue

Downloaded and set up as instructed. Does not run on my system, giving me this error:

@ start /Users/elliot/reactwork babel-node --eval “require(‘./tools/start’)().catch(err => console.log(err.stack))”

[12:16:11] Starting ‘build’… [12:16:11] Starting ‘clean’… [12:16:11] Finished ‘clean’ after 18ms [12:16:11] Starting ‘copy’… [12:16:11] Finished ‘copy’ after 8ms [12:16:11] Starting ‘bundle’… Child Time: 2975ms

ERROR in ./pages/500.js
Module build failed: SyntaxError: /Users/elliot/reactwork/pages/500.js: Unexpected token (11:19)
   9 | export default class extends Component {
  10 | 
> 11 |   static propTypes = {
     |                    ^
  12 |     error: PropTypes.instanceOf(Error),
  13 |   };
  14 | 
    at Parser.pp.raise (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:24:13)
    at Parser.pp.unexpected (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/util.js:82:8)
    at Parser.pp.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:624:61)
    at Parser.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:797:20)
    at Parser.pp.parseClass (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:567:32)
    at Parser.pp.parseExprAtom (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:405:19)
    at Parser.parseExprAtom (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/jsx/index.js:412:22)
    at Parser.pp.parseExprSubscripts (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:236:19)
    at Parser.pp.parseMaybeUnary (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:217:19)
    at Parser.pp.parseExprOps (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:163:19)
 @ ./app.js 41:11-36

ERROR in ./components/Link/Link.js
Module build failed: SyntaxError: /Users/elliot/reactwork/components/Link/Link.js: Unexpected token (21:19)
  19 | class Link extends Component {
  20 | 
> 21 |   static propTypes = {
     |                    ^
  22 |     to: PropTypes.string.isRequired,
  23 |     children: PropTypes.element.isRequired,
  24 |     state: PropTypes.object,
    at Parser.pp.raise (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:24:13)
    at Parser.pp.unexpected (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/util.js:82:8)
    at Parser.pp.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:624:61)
    at Parser.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:797:20)
    at Parser.pp.parseClass (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:567:32)
    at Parser.pp.parseStatement (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:84:19)
    at Parser.parseStatement (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:621:22)
    at Parser.pp.parseTopLevel (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:30:21)
    at Parser.parse (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/index.js:70:17)
    at Object.parse (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/index.js:45:50)
 @ ./components/Navigation/Navigation.js 21:12-30

Child Time: 2319ms Asset Size Chunks Chunk Names app.node.js 33.2 kB 0 [emitted] main

ERROR in ./pages/500.js
Module build failed: SyntaxError: /Users/elliot/reactwork/pages/500.js: Unexpected token (11:19)
   9 | export default class extends Component {
  10 | 
> 11 |   static propTypes = {
     |                    ^
  12 |     error: PropTypes.instanceOf(Error),
  13 |   };
  14 | 
    at Parser.pp.raise (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:24:13)
    at Parser.pp.unexpected (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/util.js:82:8)
    at Parser.pp.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:624:61)
    at Parser.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:797:20)
    at Parser.pp.parseClass (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:567:32)
    at Parser.pp.parseExprAtom (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:405:19)
    at Parser.parseExprAtom (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/jsx/index.js:412:22)
    at Parser.pp.parseExprSubscripts (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:236:19)
    at Parser.pp.parseMaybeUnary (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:217:19)
    at Parser.pp.parseExprOps (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:163:19)
 @ ./app.js 39:11-36

ERROR in ./components/Link/Link.js
Module build failed: SyntaxError: /Users/elliot/reactwork/components/Link/Link.js: Unexpected token (21:19)
  19 | class Link extends Component {
  20 | 
> 21 |   static propTypes = {
     |                    ^
  22 |     to: PropTypes.string.isRequired,
  23 |     children: PropTypes.element.isRequired,
  24 |     state: PropTypes.object,
    at Parser.pp.raise (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:24:13)
    at Parser.pp.unexpected (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/util.js:82:8)
    at Parser.pp.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:624:61)
    at Parser.parseClassProperty (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:797:20)
    at Parser.pp.parseClass (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:567:32)
    at Parser.pp.parseStatement (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:84:19)
    at Parser.parseStatement (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:621:22)
    at Parser.pp.parseTopLevel (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:30:21)
    at Parser.parse (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/parser/index.js:70:17)
    at Object.parse (/Users/elliot/reactwork/node_modules/babel-core/node_modules/babylon/lib/index.js:45:50)
 @ ./components/Navigation/Navigation.js 21:12-30

[12:16:14] Finished ‘bundle’ after 2997ms [12:16:14] Starting ‘render’… Error: Cannot find module “…/Link” at webpackMissingModule (/Users/elliot/reactwork/build/app.node.js:297:79) at Object.module.exports.Object.defineProperty.value (/Users/elliot/reactwork/build/app.node.js:297:163) at webpack_require (/Users/elliot/reactwork/build/app.node.js:21:30) at Object.module.exports.Object.defineProperty.value (/Users/elliot/reactwork/build/app.node.js:251:21) at webpack_require (/Users/elliot/reactwork/build/app.node.js:21:30) at Object.<anonymous> (/Users/elliot/reactwork/build/app.node.js:78:27) at webpack_require (/Users/elliot/reactwork/build/app.node.js:21:30) at module.exports.Object.defineProperty.value (/Users/elliot/reactwork/build/app.node.js:41:18) at Object.<anonymous> (/Users/elliot/reactwork/build/app.node.js:42:11) at Module._compile (module.js:460:26)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ianwaltercommented, Jan 14, 2016

I don’t think you can set a static property on a ES6 class like this: https://github.com/koistya/react-static-boilerplate/blob/master/components/Link/Link.js#L21

It should be:

class Link extends Component {
  // ...
}

Link.propTypes = {
  to: PropTypes.string.isRequired,
  children: PropTypes.element.isRequired,
  state: PropTypes.object,
  onClick: PropTypes.func,
};

Easy fix, but this component should just be replaced by rackt/react-router imho.

Update: I was wrong. I didn’t realize this project was using ES6+ instead of ES6.

0reactions
seizmocommented, Aug 23, 2016

Hi there, I have the same problem. I cloned RSB yesterday (master)

I get the warning on all (even the included) components.

Missing class properties transform.
class ServiceOutput extends React.Component {

static propTypes = {
^
    url: PropTypes.string,
 };

OS: Windows 10 Node: 6.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
SyntaxError: Unexpected token in JavaScript | bobbyhadz
The "Uncaught SyntaxError: Unexpected token" occurs for multiple reasons: · The error is also caused if you're making an HTTP request to a...
Read more >
syntax error: unexpected token - javascript - Stack Overflow
The error SyntaxError: Unexpected token < likely means the API endpoint didn't return JSON in its document ...
Read more >
Have a JavaScript Unexpected Token Error? Check Your Syntax
A deep look at the Unexpected Token Error in JavaScript, including a short examination of JavaScript's syntax best practices.
Read more >
How to fix: "SyntaxError: Unexpected token" in JavaScript
Despite its popularity and ease of use, JavaScript can sometimes be challenging to work with. One such issue is the SyntaxError: Unexpected ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found