Skip to content
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

node:8.2.1 SyntaxError: Unexpected token import #14

Closed
Here21 opened this issue Jul 25, 2017 · 1 comment
Closed

node:8.2.1 SyntaxError: Unexpected token import #14

Here21 opened this issue Jul 25, 2017 · 1 comment

Comments

@Here21
Copy link

Here21 commented Jul 25, 2017

npm start dev is ok, but when I run node app.js, I got these:

 node app.js 
/Users/simon/workspace/studyCode/node/vue-koa-demo/app.js:1
(function (exports, require, module, __filename, __dirname) { import Koa from 'koa';
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3

I use nvm to install node@8.2.1, I saw koa2 need version 7.6+.

@Molunerfinn
Copy link
Owner

Use npm run server instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants