Module not found error when building v1.21 #12881

Closed
opened 2025-11-02 10:23:42 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @pboguslawski on GitHub (Apr 19, 2024).

Description

make build worked fine a few days before for same gitea source and now throws

+ make build
rm -rf public/assets/js public/assets/css public/assets/fonts public/assets/img/webpack
npx webpack
assets by status 20.3 MiB [cached] 163 assets

ERROR in ./node_modules/mermaid/dist/mindmap-definition-617cf8dd.js 4:0-56
Module not found: Error: Package path ./dist/cytoscape.umd.js is not exported from package /my/path/gitea-build/node_modules/cytoscape (see exports field in /my/path/gitea-build/node_modules/cytoscape/package.json)
 @ ./node_modules/mermaid/dist/mermaid-934d9bea.js 3535:38-80
 @ ./node_modules/mermaid/dist/mermaid.core.mjs
 @ ./web_src/js/markup/mermaid.js 34:39-37:5
 @ ./web_src/js/markup/content.js 1:0-45 7:2-15
 @ ./web_src/js/index.js 20:0-76 105:2-20 110:2-19

webpack 5.88.2 compiled with 1 error in 33361 ms

Similar problem described on https://github.com/langgenius/dify/issues/3613

Gitea Version

1.21

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Compiled from sources.

Database

MySQL/MariaDB

Originally created by @pboguslawski on GitHub (Apr 19, 2024). ### Description `make build` worked fine a few days before for same gitea source and now throws ``` + make build rm -rf public/assets/js public/assets/css public/assets/fonts public/assets/img/webpack npx webpack assets by status 20.3 MiB [cached] 163 assets ERROR in ./node_modules/mermaid/dist/mindmap-definition-617cf8dd.js 4:0-56 Module not found: Error: Package path ./dist/cytoscape.umd.js is not exported from package /my/path/gitea-build/node_modules/cytoscape (see exports field in /my/path/gitea-build/node_modules/cytoscape/package.json) @ ./node_modules/mermaid/dist/mermaid-934d9bea.js 3535:38-80 @ ./node_modules/mermaid/dist/mermaid.core.mjs @ ./web_src/js/markup/mermaid.js 34:39-37:5 @ ./web_src/js/markup/content.js 1:0-45 7:2-15 @ ./web_src/js/index.js 20:0-76 105:2-20 110:2-19 webpack 5.88.2 compiled with 1 error in 33361 ms ``` Similar problem described on https://github.com/langgenius/dify/issues/3613 ### Gitea Version 1.21 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Compiled from sources. ### Database MySQL/MariaDB
GiteaMirror added the type/bugtype/upstream labels 2025-11-02 10:23:42 -06:00
Author
Owner

@silverwind commented on GitHub (Apr 19, 2024):

Maybe your node_modules broke somehow, try running make clean-all and then retry make build.

If you want to investigate deeper, could also see if a npm i alone does any changes.

@silverwind commented on GitHub (Apr 19, 2024): Maybe your `node_modules` broke somehow, try running `make clean-all` and then retry `make build`. If you want to investigate deeper, could also see if a `npm i` alone does any changes.
Author
Owner

@xiaoqingrong commented on GitHub (Apr 23, 2024):

I have the same problem. I use Apple mac M1。use docker build:docker buildx build --platform=linux/amd64 -t test/dify-web:v1.3.7 .,and cytoscape installed。bug have this errors
image

@xiaoqingrong commented on GitHub (Apr 23, 2024): I have the same problem. I use Apple mac M1。use docker build:`docker buildx build --platform=linux/amd64 -t test/dify-web:v1.3.7 .`,and cytoscape installed。bug have this errors <img width="1052" alt="image" src="https://github.com/go-gitea/gitea/assets/28303597/8630c1c9-b963-407c-8d78-b02682716cdf">
Author
Owner

@xiaoqingrong commented on GitHub (Apr 23, 2024):

I was fine before, but not lately

@xiaoqingrong commented on GitHub (Apr 23, 2024): I was fine before, but not lately
Author
Owner

@silverwind commented on GitHub (Apr 23, 2024):

Seems like upstream issue in that package: https://github.com/cytoscape/cytoscape.js/issues/3239

@silverwind commented on GitHub (Apr 23, 2024): Seems like upstream issue in that package: https://github.com/cytoscape/cytoscape.js/issues/3239
Author
Owner

@silverwind commented on GitHub (Apr 23, 2024):

What's strange is that v1.21 uses 3.26.0 while the issues are reported with 3.29.0.

@silverwind commented on GitHub (Apr 23, 2024): What's strange is that v1.21 uses [`3.26.0`](https://github.com/go-gitea/gitea/blob/fcdc57d811f51201fc196cab282821545d70c6ce/package-lock.json#L3561) while the issues are reported with `3.29.0`.
Author
Owner

@wxiaoguang commented on GitHub (Apr 23, 2024):

I also occasionally experience the similar problem (not only related to cytoscape). I just do rm -rf node_modules and then make build, then everything goes well.

I think it is the npm/webpack's problem, for example, if there is a network error (or use ^C to stop the npm process), then the node_modules directory would go corrupted. Removing node_modules directory and restart the build, then no error.


On my side (macOS M2), I tried rm -rf node_modules && make build on 1.21 branch, it succeeds.

@wxiaoguang commented on GitHub (Apr 23, 2024): I also occasionally experience the similar problem (not only related to cytoscape). I just do `rm -rf node_modules` and then `make build`, then everything goes well. I think it is the npm/webpack's problem, for example, if there is a network error (or use ^C to stop the npm process), then the `node_modules` directory would go corrupted. Removing `node_modules` directory and restart the `build`, then no error. ---- On my side (macOS M2), I tried `rm -rf node_modules && make build` on 1.21 branch, it succeeds.
Author
Owner

@pboguslawski commented on GitHub (Apr 24, 2024):

Problem started to occur in automatic build process (empty node_modules, no network errors, etc.) and occurs every time. Build process and source code were not changed in the meantime.

The problem is caused by running make generate-images before make build (we use custom logo and favicon) and removing --no-package-lock from make generate-images in Makefile resolves this issue for us.

Please verify and fix.

@pboguslawski commented on GitHub (Apr 24, 2024): Problem started to occur in automatic build process (empty node_modules, no network errors, etc.) and occurs every time. Build process and source code were not changed in the meantime. The problem is caused by running `make generate-images` before `make build` (we use custom logo and favicon) and removing `--no-package-lock` from `make generate-images` in `Makefile` resolves this issue for us. Please verify and fix.
Author
Owner

@silverwind commented on GitHub (Apr 24, 2024):

Hmm yeah make generate-images is somewhat of an oddball. Maybe we should just put those dependencies into package.json. At least the often-problematic canvas dependency is listed as optionalDependency so will not fail the whole install if it fails:

c27a21883e/package.json (L74)

@silverwind commented on GitHub (Apr 24, 2024): Hmm yeah `make generate-images` is somewhat of an oddball. Maybe we should just put those dependencies into package.json. At least the often-problematic `canvas` dependency is listed as `optionalDependency` so will not fail the whole install if it fails: https://github.com/fabricjs/fabric.js/blob/c27a21883eda49b7a7bfcc32f49eb59a099a1536/package.json#L74
Author
Owner

@silverwind commented on GitHub (Apr 24, 2024):

On topic here: Let's wait on https://github.com/cytoscape/cytoscape.js/issues/3239 and a future mermaid.js update to resolve this hopefully.

@silverwind commented on GitHub (Apr 24, 2024): On topic here: Let's wait on https://github.com/cytoscape/cytoscape.js/issues/3239 and a future mermaid.js update to resolve this hopefully.
Author
Owner

@silverwind commented on GitHub (Apr 26, 2024):

https://github.com/go-gitea/gitea/pull/30713 updates main branch to the fixed cytoscape version.

└─┬ mermaid@10.9.0
  ├─┬ cytoscape-cose-bilkent@4.1.0
  │ └── cytoscape@3.29.2 deduped
  └── cytoscape@3.29.2
@silverwind commented on GitHub (Apr 26, 2024): https://github.com/go-gitea/gitea/pull/30713 updates main branch to the fixed cytoscape version. ``` └─┬ mermaid@10.9.0 ├─┬ cytoscape-cose-bilkent@4.1.0 │ └── cytoscape@3.29.2 deduped └── cytoscape@3.29.2 ```
Author
Owner

@yp05327 commented on GitHub (Jun 3, 2024):

Is this issue fixed after bump the version of dependencies?

@yp05327 commented on GitHub (Jun 3, 2024): Is this issue fixed after bump the version of dependencies?
Author
Owner

@silverwind commented on GitHub (Jun 3, 2024):

Pretty sure it should.

@silverwind commented on GitHub (Jun 3, 2024): Pretty sure it should.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12881