전적으로 React에 익숙하며 예제를 따르려는 시도는 react official website입니다.WebStorm을 사용하여 React 앱을 실행할 수 없습니다.
WebStorm 또는
output of npm run start or npm start
궁극적 인 IntelliJ 아이디어를 사용하여 계산기 응용 프로그램 (하는 index.js)를 실행 그리고 난이 오류다면 :
(function (exports, require, module, __filename, __dirname) { import React from 'react';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Process finished with exit code 1
내 질문은 그런를 실행하는 방법입니다 응용 프로그램 intellij 궁극적 인 아이디어를 사용하여 내가 무엇을 시도 :
npm install -g create-react-app
npm install -g eslint
npm install --save-dev babel-preset-es2015
npm install --save-dev babel-core babel-preset-es2015 babel-preset-react
npm install -g eslint babel-eslint eslint-plugin-react eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-flowtype
그리고 package.json에 다음과 같은 추가 :
"babel": {
"presets": [ "es2015", "react" ]
}
또는 내 질문이 인 IntelliJ 아이디어 궁극적 package.json을 사용하여 이러한 응용 프로그램을 실행하는 방법입니다
{
"presets": [ "es2015", "react" ]
}
을 .babelrc하는
{
"name": "emoji-search",
"version": "0.1.0",
"private": true,
"homepage": "http://ahfarmer.github.io/emoji-search",
"devDependencies": {
"gh-pages": "^1.1.0",
"react-scripts": "^1.0.17"
},
"dependencies": {
"github-fork-ribbon-css": "^0.2.1",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": "./node_modules/react-scripts/config/eslint.js"
},
"babel": {
"presets": [ "es2015", "react" ]
}
}
(내 질문은 궁극적 인 intellij 아이디어를 사용하여 이러한 응용 프로그램을 실행하는 방법입니다)
'npm start'로 애플리케이션을 시작 하시겠습니까? –
아니요 with webStrom – Pro
package.json 파일을 공유 할 수 있습니까? –