-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected token import - first build #400
Comments
Please confirm that .babelrc is in your project root.
…On Mar 28, 2017 3:51 PM, "Steve Calabro" ***@***.***> wrote:
Node version: 6.9.5
npm version: 3.10.10
Operating system: Windows 10
Command line used: Git Bash
Steps to reproduce:
- Clone the project
- Run npm install
- Run npm run setup
- Error appears
(function (exports, require, module, __filename, __dirname) { import { chalkSuccess } from './chalkConfig';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at loader (C:\Users\{project folder}\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\{project folder}\node_modules\babel-register\lib\node.js:154:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Function.Module.runMain (module.js:604:10)
at C:\Users\{project folder}\node_modules\babel-cli\lib\_babel-node.js:159:24
at Object.<anonymous> (C:\Users\{project folder}\node_modules\babel-cli\lib\_babel-node.js:160:7)```
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#400>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ABnFpeMP3Dl7DQ4Qo3Lec0ZpP5l1Mnxuks5rqXLOgaJpZM4MsLYA>
.
|
I confirmed that the file was there. I found the reason why in case anyone else comes across this issue. It is specifically a problem with windows machines I believe. I tried the setup on my Ubuntu box and it works fine. When working with windows you need to have the following installed The reason behind this is that the |
Great to hear you got it solved Steve! And thanks for sharing your solution. Curious - Why did you have NODE_ENV set to production on your machine? |
I'm not entirely sure. I have a feeling it was with another project I was doing with React/webpack earlier this week |
I am having the same issue. When I use the slingshot locally on my Mac it is fine. Once I upload it to Github I can't "npm start" without getting the error
|
@iM-Durant7 When you say "Once I upload it to Github I can't "npm start" without getting the error", how are you running it when up once up on GitHub? Have you confirmed .babelrc is uploaded? |
I created a repo in github and copied the files over from my local machine. After npm install, I used "Npm start -s". You can look at my current repo "React.StocksApp" it has the .babel and I ran a console "hello world" to verify that .babel was working. |
@iM-Durant7 Your .babelrc doesn't match Slingshots: https://github.com/coryhouse/react-slingshot/blob/master/.babelrc I just tried Slingshot's .babelrc on your project and it started fine. |
oh wow, ok thanks! I think once I uninstalled the demo project it took my babel away and I was lost 😢. |
Node version: 6.9.5
npm version: 3.10.10
Operating system: Windows 10
Command line used: Git Bash
Steps to reproduce:
npm install
npm run setup
The text was updated successfully, but these errors were encountered: