node.js - How to solve the problem that nodejs on Alibaba Cloud does not support import, and the project reports Unexpected token import after npm run build
仅有的幸福
仅有的幸福 2017-06-20 10:06:58
0
3
1069

1. The problem is as the title says. After deploying the vue project, everything goes fine when npm run dev is executed, but an error keeps reporting after npm run build is executed.

2. My Alibaba Cloud The operating system is ubuntu and the node version is 6.1.0
3. After searching online, it seems that the nodejs6 version does not support import, but why does nodejs on my local computer not report an error?
4. Please give us your suggestions, thank you all!

仅有的幸福
仅有的幸福

reply all(3)
小葫芦

node6 does not support import syntax, solution:
1. Change import to require
2. Update node to 8.0

刘奇

I have encountered a similar problem. I have no problem packaging with mac, but there is a problem with window packaging. I suspect it is a problem with the npm version, because the node version of mac is the same as the node version of window, but npm is different. Mac is 3.xxx, window is 4.xx

某草草

node6 does not support import syntax. You should post package.json and part of the code

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template