#Unable to develop an npm linked module (error: "fails to load url")

9 messages · Page 1 of 1 (latest)

heady gulch
#

Hello.

I've just set up a starter module repo using the starter template code and have NPM linked it from a Nuxt project.

However, when I configure Nuxt to see the module, and start the server, I get the following error:

ERROR  Failed to load url /@fs/Volumes/Data/Work/Projects/nuxt-landkit/dist/runtime/plugin.mjs 
(resolved id: /Volumes/Data/Work/Projects/nuxt-landkit/dist/runtime/plugin.mjs) 
in virtual:nuxt:/Volumes/Data/Work/Projects/controlspace-site/.nuxt/plugins/client.mjs. 

Does the file exist?

I have run the prepare and build scripts in the module repo, and I can see the files exist.

However, if I copy/paste the code to my app's modules folder, it works first time.

Is it that Nuxt / Nitro doesn't see them, or is there something else at play?

gusty knot
#

if it's just for testing you can probably do something like

#
import MyModule from '../../packages/my-module/src/module'

export default defineNuxtConfig({
  modules: [
    MyModule,
  ]
})
hexed violet
#

It works for me using npm pack
But npm link allows you to have an instant overview with hot reloading

hexed violet
wary marlin
#

I'm currently doing this with pnpm link and it's working fine for me. I had to add vite: { server: { fs: { allow: ["path/to/dir"], }, }, }, so vite would allow serving the content from that dir @hexed violet

#

@heady gulch

hexed violet
#

Thank you ! It works