【发布时间】:2021-11-07 19:21:03
【问题描述】:
我正在尝试使用 franc 包,但每次我尝试运行它时都会出现此错误“请求的模块 'franc' 不提供名为 'default' 的导出”,我不知道这意味着什么。我尝试将文件名更改为 mjs 或在 package.json 中添加“type”="module" 但这只会给我这个错误,我在网上找不到任何解决方案。
注意:--experimental-modules 不起作用(它说 '\302\226 npm': command not found)
这是js文件(我在package.json中添加了“type”="module")
import franc from 'franc';
console.log(franc('Hi, I speak english!'));
这是 package.json
{
"name": "curs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"franc": "^6.0.0",
"lang": "^0.1.1"
}
}
PS:忽略 lang 我的意思是首先让法郎运行。
【问题讨论】:
标签: javascript node.js json github npm