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

Module not found error when building v1.21 #30596

Closed
pboguslawski opened this issue Apr 19, 2024 · 12 comments
Closed

Module not found error when building v1.21 #30596

pboguslawski opened this issue Apr 19, 2024 · 12 comments
Labels
type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there

Comments

@pboguslawski
Copy link
Contributor

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 langgenius/dify#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

@silverwind
Copy link
Member

silverwind commented 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.

@lunny lunny added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Apr 19, 2024
@xiaoqingrong
Copy link

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
Copy link

I was fine before, but not lately

@silverwind
Copy link
Member

silverwind commented Apr 23, 2024

Seems like upstream issue in that package: cytoscape/cytoscape.js#3239

@silverwind silverwind added type/upstream This is an issue in one of Gitea's dependencies and should be reported there and removed issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail labels Apr 23, 2024
@silverwind
Copy link
Member

silverwind commented Apr 23, 2024

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

@wxiaoguang
Copy link
Contributor

wxiaoguang commented 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.

@pboguslawski
Copy link
Contributor Author

pboguslawski commented 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.

@silverwind
Copy link
Member

silverwind commented 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

@silverwind
Copy link
Member

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

silverwind added a commit that referenced this issue Apr 25, 2024
This upgrades `generate-images.js` on v1.21 to the latest version from
main branch and I ran it which generated some minor diff in the SVGs. It
fixes one issue mentioned in
#30596 (comment)
by removing `--no-package-lock`.
@silverwind
Copy link
Member

silverwind commented Apr 26, 2024

#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

techknowlogick pushed a commit that referenced this issue Apr 27, 2024
Update mermaid and its dependencies on v1.21. Should fix
#30596 because it includes the
fixed version of the `cytoscape` indirect dependency.
@yp05327
Copy link
Contributor

yp05327 commented Jun 3, 2024

Is this issue fixed after bump the version of dependencies?

@silverwind
Copy link
Member

Pretty sure it should.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there
Projects
None yet
Development

No branches or pull requests

6 participants