报错:Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs extension
在学习ES6的过程中,和运行javascript文件时进行了报错,具体重现
1、新建文件加夹test-es,使用IDEA进行打开文件夹
2、添加package.json文件: npm init -y
3、在文件夹test-es中新建 test.js文件,里面的内容如下
let a = 1111
let b = 2222
var c = function(){console.log(3333)
}
function ddd(){console.log(4444)
}
function eeeeee5(){console.log(555)
}
export {a,b,c,ddd,eeeeee5 as eee, //重命名的方式:将 eeeeee 命名为 eee,可以以不同的命名输出同一个变量或者方法eeeeee5 as e5 //重命名的方式:将 eeeeee 命名为 eee,可以以不同的命名输出同一个变量或者方法
}
4、右键,点击 Run ‘test.js’,报错如下:
解决
依据报错提示,在package.json添加 “type”: “module”,然后再运行test.js文件,便不再报错
报错:Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs extension相关推荐
- 解决运行js代码报错—Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs
目录 ❌ 报错信息
- 力扣报错runtime error: load of null pointer of type ‘int‘解决思路
记录本算法小白刷力扣的这道题遇到的报错 349. 两个数组的交集https://leetcode.cn/problems/intersection-of-two-arrays/ 出现报错的代码 /** ...
- linux c 报错 warning: large integer implicitly truncated to unsigned type[-Woverflow]
警告的原因是:整数溢出 整数溢出:当整数达到它所能表述的最大值时,会重新从起点开始 #include<stdio.h> int main(void) {unsigned a=1234567 ...
- 记录 | node运行报错To load an ES module, set “type“: “module“ in the package.json or use the .mjs extens
报错:To load an ES module, set "type": "module" in the package.json or use the .mj ...
- 安装Kibana报错[warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
实验环境 : Ubuntu 160.4 Kibana :kibana-6.2.3 报错信息 : log [07:23:26.511] [warning][admin][elasticsearch] N ...
- vagrant up报错 Warning: Authentication failure. Retrying...解决方案
vagrant up报错 Warning: Authentication failure. Retrying...解决方案 参考文章: (1)vagrant up报错 Warning: Authent ...
- 使用conda报错:from conda.cli import main ModuleNotFoundError: No module named conda
使用conda报错:from conda.cli import main ModuleNotFoundError: No module named 'conda' 文章目录: 1 错误出现原因 2 解 ...
- idea报错:Error:java: JDK isn‘t specified for module ‘xxx‘
idea报错:Error:java: JDK isn't specified for module 'xxx' Code_LiYi 2020-07-01 11:54:34 274 收藏 分类专栏: ...
- ionic4 背景设置动态图片报错WARNING: sanitizing unsafe style value background-image:url
ionic4 背景设置动态图片报错WARNING: sanitizing unsafe style value background-image:url WARNING: sanitizing uns ...
- react-native---配置reactnative报红,run-Android时候报错unable to load script from assets 'index.android.bundl
react-native-配置reactnative报红,run-Android时候报错unable to load script from assets 'index.android.bundle ...
最新文章
- ADAS感知算法观察
- Eclipse里的文件搜索
- 英特尔史上最大收购!英特尔拟300亿美元收购GF,审批成关键!
- 韦布望远镜现在到哪儿了:距离地球60万公里,NASA还说可以用10年
- WebDriver原理分析
- 12款优秀的 JavaScript 日历和时间选择控件
- 用户线程和内核线程之间的区别
- Numpy基础(part1)--ndarray数组
- 《iVX 高仿美团APP制作移动端完整项目》01 标题需求分析思路及制作流程
- mysql的这几个坑你踩过没?真是防不胜防
- linux中vim内容定位,Linux运维行走江湖必备之:vim命令常用参数
- selenium自动化测试-2.浏览器基本操作
- ekf pose使用方法 ros_【百川小课堂】第13课—ROS学习(二)
- python之celery使用详解一
- CentOS下安装php gd库报错Error: php56w-common conflicts with php-common-5.3.3-48.el6_8.x86_64
- 米勒-拉宾素性检验(MillerRabbin)算法详解
- windows简单命令系统优化
- 多播(组播)、单播、任播和广播
- 计算机表格的名次怎么弄,excel表格怎么给成绩排名
- linux v4l2系统详解,Linux摄像头驱动学习之:(一)V4L2_框架分析