我的 Mac 上有一个基本的 express.js 服务器设置。为此,我尝试按照说明导入 Tone.js,https: //tonejs.github.io 。
npm install tone
要导入 Tone.js:
import * as Tone from 'tone'
但我收到了这个错误
未捕获的类型错误:无法解析模块说明符“音调”。相对引用必须以“/”、“./”或“../”开头。
我的包文件看起来像这样
{
"name": "XXXXX",
"version": "1.0.0",
"description": "Run npm start",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon start"
},
"repository": {
"type": "git",
"url": "git+https://github.com/xxxxx"
},
"author": "xxxxx xxxx",
"license": "ISC",
"bugs": {
"url": "https://github.com/xxxxxxx"
},
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12",
"tone": "^14.7.77"
}
}