参考资料:https://www.jianshu.com/p/60a8a74f5eee?ivk_sa=1024320u
使用 vs code 调试js 代码,出现如上报错
解决过程:
- npm init -y
- 在 package.json 中添加字段 type
package.json标签:use,code,outside,module,js,json,www,test From: https://blog.51cto.com/u_12890843/6132734
{
"name": "promise",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}