React Setup

Hi everyone,

I’ve been doing the tutorial for setting up a react app with babel and webpack located here: https://www.codecademy.com/articles/react-setup-i

When I try

npm run build

I get this error code:

SyntaxError: Unexpected token ;
at new Script (vm.js:83:7)
at NativeCompileCache._moduleCompile (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at WEBPACK_OPTIONS (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/utils/convert-argv.js:116:13)
at requireConfig (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/utils/convert-argv.js:118:6)
at /Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/utils/convert-argv.js:125:17
at Array.forEach ()
at module.exports (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/utils/convert-argv.js:123:15)
at yargs.parse (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/cli.js:71:45)
at Object.parse (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
at /Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/cli.js:49:8
at Object. (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack-cli/bin/cli.js:365:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/Users/JMarkusHaber/Documents/Code/ReactWebpack/node_modules/webpack/bin/webpack.js:156:2)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactwebpack@1.0.0 build: webpack
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactwebpack@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

What’s going wrong and how can I fix this?

here:

at new Script (vm.js:83:7)

do you have a file named vm.js? Check line 83, seems to be a problem with a semi-colon

2 Likes

There is a vm.js in the modules, but it only has 36 lines of code.

no very obvious other errors in the stacktrace… i need some time to research this

3 Likes

To make a wild guess since you’re not providing a way of reproducing it…

jsx compiles into javascript, doesn’t it?

so after compiling, it would look different. there may very well be more lines after that step

If you know it’s a rogue semicolon within 36 lines then that’ll take you about as many seconds to look through. And even if it didn’t, you could look at the compiled output and cross reference it. or figure out how react developers debug their code.

4 Likes