Please help starting ReactStarterKit on Webstorm 11

     I've been at this for hours and I am having difficulty getting the ReactStarterKit up and running.

Here are the steps that I've followed.

1. Start new project, select ReactStarterKit and create the project.
2. Follow the instructions here by changing the language to ES6, and adding Babel to the watch list.
3. Under Language & Frameworks > Javascript > Libraries select Nodejs Core Modules and Nodejs Globals
4. I open server.js under the src folder. You will see the node_modules folder missing and a lot of "Cannot resolve file [x]" for the files being imported.
5. Click on View>Tool Windows>Terminal and run "npm install --save" and wait for the packages to finish installing and errors will go awat


Now what do you do to run the app?? I go on the server.js file and hit "Run server.js" and I get the following errors:

/usr/local/bin/node server.js
/Users/admin/WebstormProjects/untitled2/src/server.js:3
import 'babel/polyfill';
^^^^^^

SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:413:25)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
    at node.js:951:3

Process finished with exit code 1


It seems that Webstorm doesn't like the "import" keyword. I'm not sure if Babel is working, but when I go inside Tools>FileWatchers I can see Babel ticked and the configuration looks fine.

Any help would be appreciated :)

1 comment
Comment actions Permalink

It's not WebStorm, it's Node.js that doesn't support ES6 syntax natively. See http://stackoverflow.com/questions/32346886/unexpected-reserved-word-import-in-node-js, for example.
You have followed the instructions for installing Babel and setting up the file watcher, but seems you don't understand what it's supposed to be used for... You need to make sure to transpile the ES6 code with Babel and then run the transpiled code with Node.js - rather than trying to execute original sources written in ES6

0

Please sign in to leave a comment.