gpt4 book ai didi

android - 找不到模块 : Error: Can't resolve 'nativescript-sound'

转载 作者:行者123 更新时间:2023-11-29 02:29:20 26 4
gpt4 key购买 nike

我正在尝试在基于 nativescript/vue-cli 的应用程序中使用 nativescript-sound 包。我使用

安装 nativescript-sound

npm install --save nativescript-sound

安装后我运行 npm clean 然后尝试在我的项目的 main.js 文件上调用 nativescript-sound

require("nativescript-vue").registerElement("sound", () => require("nativescript-sound").sound);

当我尝试运行时

npm run watch:android

编译器显示错误。

错误

 ERROR in ./src/main.js
Module not found: Error: Can't resolve 'nativescript-sound' in
'/home/darahat/Desktop/Rhymes/src'
@ ./src/main.js
  1. 我的问题是为什么它显示错误?
  2. nativescript-sound 是否支持 nativescript/vue cli?
  3. 如果不支持我可以使用哪个插件来添加背景音和点击按钮声音?

最佳答案

我改变了node_modules/nativescript-sound/package.json

"main": "sound.js",

"main": "sound",

而且有效!

let Sound = require("nativescript-sound");

关于android - 找不到模块 : Error: Can't resolve 'nativescript-sound' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50502954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com