当我运行时,yarn dev
我得到以下输出:
yarn run v1.22.10
warning package.json: No license field
$ vite
⚡️⚡️ Hello RSW! ⚡️⚡️
⚡️⚡️ Vite + Rust WebAssembly ⚡️⚡️
vite-plugin-rsw (1.8.0)
[rsw::deploy] https://github.com/lencx/rsw-node
[rsw::optimized] wasm-pack build wasm.
up to date, audited 241 packages in 3s
7 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../../../home/isaachmi/projects/my-blackspace/wasm/pkg
npm ERR! dest /usr/lib/node_modules/wasm
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../../../home/isaachmi/projects/my-blackspace/wasm/pkg' -> '/usr/lib/node_modules/wasm'
npm ERR! [Error: EACCES: permission denied, symlink '../../../home/isaachmi/projects/my-blackspace/wasm/pkg' -> '/usr/lib/node_modules/wasm'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../../../home/isaachmi/projects/my-blackspace/wasm/pkg',
npm ERR! dest: '/usr/lib/node_modules/wasm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/isaachmi/.npm/_logs/2021-07-21T14_44_01_966Z-debug.log
[rsw::npm::link]
↳ wasm /home/isaachmi/projects/my-blackspace/wasm/pkg
error when starting dev server:
Error: The following dependencies are imported but could not be resolved:
wasm (imported by /home/isaachmi/projects/my-blackspace/src/components/HelloWorld.vue)
Are they installed?
at optimizeDeps (/home/isaachmi/projects/my-blackspace/node_modules/vite/dist/node/chunks/dep-f2b4ca46.js:73091:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOptimize (/home/isaachmi/projects/my-blackspace/node_modules/vite/dist/node/chunks/dep-f2b4ca46.js:73765:48)
at async Server.httpServer.listen (/home/isaachmi/projects/my-blackspace/node_modules/vite/dist/node/chunks/dep-f2b4ca46.js:73779:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我的 WebAssembly 包被调用wasm
,这是我的 vite 配置:
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import ViteRsw from "vite-plugin-rsw";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
ViteRsw({
crates: ["wasm"],
}),
],
});
我正在使用vite插件来使用 Rust 和 WebAssembly。我遵循了他们在 Vue3 中使用的示例,但使用了我的包。难道我做错了什么?