node V16.16.0 无法使用import语句
发布于 1 年前 作者 scottMan1001 4362 次浏览 来自 问答

PS E:\study\forVideo> npm run start

microblog@0.0.0 start node ./bin/www

E:\study\forVideo\service\service.js:1 import got from “got”; ^^^^^^

SyntaxError: Cannot use import statement outside a module

请问这是为什么? 项目框架是 “express”: “~4.16.1”, “got”: “^12.5.3”,

3 回复

把后缀改成.mjs 试试

代码是什么

回到顶部