尝试启动 WebAssembly + Vite + Vue 的开发服务器时,“您可能没有权限”

问题描述

当我运行 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"],}),],});

我正在使用 plugin for vite 来使用 Rust 和 WebAssembly。我遵循了他们在 Vue3 中使用的示例,但使用了我的包。我做错了什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...