ES6 import statements not working in Node v8.4.0

前端 未结 2 1022
独厮守ぢ
独厮守ぢ 2021-02-14 16:47

I\'m using the latest version of Node.js that is v8.4.0. However, in the import and export statements, I\'m getting errors:

import express from \'express\';
             


        
2条回答
  •  耶瑟儿~
    2021-02-14 17:16

    const express = require('express'); is the right syntax as some es6 features ie import express from express is currently not available with node!

提交回复
热议问题