nitrojs / nitrojs/nitro

Some files were not copied to .output/server/node_modules during build

Open
#1,486 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug nuxt v2 windows
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

   Forwarded from downstream issue:


Environment
  • Operating System: Windows_NT
  • Node Version: v18.16.1
  • Nuxt Version: 3.6.1
  • Nitro Version: 2.5.1
  • Package Manager: pnpm@7.13.6
  • Builder: vite
  • User Config: modules, colorMode
  • Runtime Modules: @nuxtjs/tailwindcss@6.8.0, nuxt-icon@0.3.3, @nuxtjs/color-mode@3.3.0
  • Build Modules: -
Reproduction

https://stackblitz.com/edit/nuxt-starter-amtrbm?file=server%2Fapi%2Ficons.ts

Steps:

npm run build
npm run preview

visit /api/icons

Describe the bug

no such file or directory, open '/home/projects/nuxt-starter-amtrbm/.output/server/node_modules/@iconify/json/collections.json
image

My api depends on iconify's api, but after build, the main files of the @iconify/json package were not copied to the .output/server/node_modules/@iconify/json directory

I saw a similar issue: https://github.com/nuxt/nuxt/issues/13131

Additional context

It works in nuxt dev

correct directory structure:
image

Logs
{"url":"/api/icons","statusCode":500,"statusMessage":"","message":"ENOENT: no such file or directory, open '/home/projects/nuxt-starter-amtrbm/.output/server/node_modules/@iconify/json/collections.json'","stack":""}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction's server/api/icons.ts entry point and run npm run build followed by npm run preview. Inspect the generated .output/server/node_modules/@iconify/json contents and compare them with the package's expected files; done means the /api/icons request can read collections.json after a production build.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, nuxt, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.