欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js代碼運(yùn)行報(bào)錯(cuò)Warning:To?load?an?ES?module,?set?"type":"module"in?the?package.json?or?use?the?.mjs

 更新時(shí)間:2023年04月24日 09:23:31   作者:儒雅的烤地瓜  
最近在學(xué)習(xí)ES6的過(guò)程中,和運(yùn)行javascript文件時(shí)進(jìn)行了報(bào)錯(cuò),下面這篇文章主要給大家介紹了關(guān)于js代碼運(yùn)行報(bào)錯(cuò)Warning:To?load?an?ES?module,?set?"type":"module"in?the?package.json?or?use?the?.mjs的相關(guān)資料,需要的朋友可以參考下

報(bào)錯(cuò)信息

vscode運(yùn)行js代碼報(bào)錯(cuò):(node:20452) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. 

# 查看報(bào)錯(cuò)信息
Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
警告:加載ES模塊時(shí),在package.json包中設(shè)置“ type”:“ module”或使用.mjs擴(kuò)展名。

解決方案

1、安裝新版node.js

2、使用npm init -y初始化項(xiàng)目,生成一個(gè)pakeage.json文件

3、在pakeage.json文件中添加"type": "module"

同類(lèi)型報(bào)錯(cuò)的情況,都可以使用該方案解決!

執(zhí)行結(jié)果

總結(jié)

到此這篇關(guān)于js代碼運(yùn)行報(bào)錯(cuò)Warning:To load an ES module, set "type":"module"in the package.json or use the .mjs的文章就介紹到這了,更多相關(guān)js代碼運(yùn)行Warning To load an ES module內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論