ES6 import statements not working in Node v8.4.0

前端 未结 2 1386
天命终不由人
天命终不由人 2021-02-14 16:30

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:02

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

提交回复
热议问题