Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

reactjs - Command not configured for JavaScript (JSX)! Scrimba 'learn react' course

Im currently doing the 'learn react' course on scrimba. I've run into a problem at the very beginning

import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(<h1>Hello world</h1>, document.getElementById("root"))

When I try to run the code above (in atom), i get 'Command not configured for JavaScript (JSX)!' error. Also when i created a react project, after opening the default .js files I got the same error. Any help appreciated!

update: changing filename to .jsx 'fixed' the above error but now im getting

 SyntaxError: /Users/dmccaul/.atom/packages/script/node_modules/.bin/babel: Unexpected token (4:16)
  2 | import ReactDOM from 'react-dom';
  3 | 
> 4 | ReactDOM.render(<h1>Hello world</h1>, document.getElementById("root"))
    |                 ^

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This error is most likely coming from the atom-script plugin, see this issue and this commit. You will the babel-node package to get it working.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...