Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt Module Runtime Error #1453

Open
corepay opened this issue Apr 17, 2024 · 13 comments
Open

Nuxt Module Runtime Error #1453

corepay opened this issue Apr 17, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@corepay
Copy link

corepay commented Apr 17, 2024

What happens?

Install plugin via npx nuxi module add @scalar/nuxt on fresh install no problems adding module.

  • Using bun worspaces
  • Without adding module to nuxt.config or any other changes:

bun run dev

[4:22:29 PM] ERROR Cannot start nuxt: Cannot find module '/home/runner/work/scalar/scalar/node_modules/.pnpm/[email protected]/node_modules/jiti/lib/index.js'

Tried this on both a fresh full nuxt app app and in a layers app same result.

NOTICING...

In the layers and full app where I run the plugin installation the package.json gets the "@scalar/nuxt": "^0.0.5", as dependency BUT the "@scalar/api-reference": "^1.21.2", is stuffed into the root bun workspace package.json. I tremoved @scalar/api-reference and tried to add it to the layers/nuxt3 app in th workspace but got the above error and won't build at all now.

What did you expect to happen?

Able to run nuxt app with or without module enabled in nuxt.config

How can we reproduce the issue?

  1. fresh empty folder add a bun workspace package.json to root:
{
  "name": "bun-workspace",
  "private": true,
  "workspaces": [
    "apps/*",
    "layers/*"
  ]
}

create 2 folders: layers and apps

In the layers folder:

  • create a nuxt layer app npx nuxi init -t layer layerapp and use bun as build tool option
    cd to layerapp:
  • install scalarnpx nuxi module add @scalar/nuxt.
  • then bun run dev

You should get the same error message.

To test on a full nuxt app you'll need to delete the layerapp becuase you won't be able to install a new app now because a build error from the workspace layerapp scalar module is created.

In the apps folder:

  • create a nuxt app npx nuxi init nuxtapp and use bun as build tool option
    cd to nuxtapp:
  • install scalarnpx nuxi module add @scalar/nuxt.
  • then bun run dev

Swagger/OpenAPI Example

No response

@corepay corepay added the bug Something isn't working label Apr 17, 2024
@corepay
Copy link
Author

corepay commented Apr 17, 2024

ADD: I do not think this is a bun issue or a bun workspaces related problem. I did fresh installs using bun as a build tool standalone outside of any workspace and same error after installing plugin. I then did a fresh nuxt3 app install using pnpm as a build tool and same errors.

@corepay
Copy link
Author

corepay commented Apr 17, 2024

The referenced missing file in the error does indeed exist in the node_modules:

image

@amritk
Copy link
Member

amritk commented Apr 19, 2024

hey @corepay can you update to version 0.0.9 and try again? it should be good now.

Cheers

@corepay
Copy link
Author

corepay commented Apr 19, 2024

Sure I will.

FYI I found the backdoor to really what I wanted to accomplish was have an API attached to my nuxt project for rapid prototype via what looks to be built into nitro server already https://nitro.unjs.io/config#experimental - no plugin needed

@amritk
Copy link
Member

amritk commented Apr 19, 2024

Yep the nitro one already existed for prototyping. This new nuxt one will be good for user facing docs as they are server side rendered now!

@corepay
Copy link
Author

corepay commented Apr 19, 2024

It's early I just woke up and haven't had any coffee yet so maybe I'm still in bed dreaming but this is what I am getting:

image

I am a tthe root of my nuxt project. Tried both npx nuxi module add @scalar/nuxt and npx nuxi module add @scalar/[email protected]

rp@MBP Admin % npx nuxi module add @scalar/nuxt

ℹ Installing dev dependency @scalar/nuxt@latest                                                    4:18:48 AM

 ERROR  No package manager auto-detected.                                                           4:18:48 AM

  at resolveOperationOptions (/Users/rp/node_modules/nuxi/dist/shared/nuxi.5d0fe0bd.mjs:52:11)
  at async addDependency (/Users/rp/node_modules/nuxi/dist/shared/nuxi.5d0fe0bd.mjs:165:27)
  at async Object.setup (/Users/rp/node_modules/nuxi/dist/chunks/add2.mjs:26605:19)
  at async runCommand$1 (/Users/rp/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1620:5)
  at async runCommand$1 (/Users/rp/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runCommand$1 (/Users/rp/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runMain$1 (/Users/rp/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1773:7)


✔ Install failed for @scalar/nuxt@latest. Do you want to continue adding the module to nuxt.config?
No
rp@MBP Admin % npx nuxi module add @scalar/[email protected]

ℹ Installing dev dependency @scalar/[email protected]                                                     4:21:31 AM

 ERROR  No package manager auto-detected.                                                           4:21:31 AM

@corepay
Copy link
Author

corepay commented Apr 19, 2024

Remember I am in a bun workspace here.

I did a fresh install outside of the workspace and everything installed correctly. I'll configure it now and see what I can do there

@corepay
Copy link
Author

corepay commented Apr 19, 2024

bun run dev fresh install right after plugin and update nuxt.config.ts:

image

image

@amritk
Copy link
Member

amritk commented Apr 19, 2024

Okay so the issue was with adding bun to an existing project?

@corepay
Copy link
Author

corepay commented Apr 19, 2024

no - brand new nuxt install in my project bun workspace resulted in first error:
image

then did brand new nuxt install with bun outside the workspace adn got the 2nd error.

image

Different errors based on the install environment.

@corepay
Copy link
Author

corepay commented Apr 19, 2024

Bun isn't something you add - it is a build tool supported by Nuxt. The nuxt projects build fine until I add the 0.0.9 scalar plugin then can't get a clean build with bun run dev

@amritk
Copy link
Member

amritk commented Apr 22, 2024

hmm the first one looks like a possible issue with the install command since it can't find out which package manager you are using.

The second one can be ignored for now, I'll figure out why the source maps aren't working

@corepay
Copy link
Author

corepay commented Apr 22, 2024

I dont have time to test right now but just had a thought might be helpful. Try installing the module via bunx instead of npx as in bunx nuxi module add @scalar/[email protected]. I probably should be doing this already but to this point npx works just fine on other modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants