我的Mac上有一个基本的express.js服务器设置。为此,我将按照说明导入Tone.js,https://tonejs.github.io。
npm install tone要导入Tone.js:
import * as Tone from 'tone'但我发现了这个错误
未登录的TypeError:未能解决模块说明符“音调”。相对引用必须以"/“、"./”或“./”开头。
我的包文件看起来像这样
{
"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"
}
}发布于 2021-08-27 11:14:28
正如@所指出的那样,不可能在node.js服务器上运行它。最后,我从这里下载了Tones.js,并将其作为常规脚本标记。
https://stackoverflow.com/questions/68951739
复制相似问题