Installation scripts are not executed when installing package via npm #9749

Open
opened 2025-11-02 08:48:31 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @patricwi on GitHub (Oct 28, 2022).

Description

npm allows packages to specify installation scripts that are executed in a given life-cycle order, as specified in the npm documentation

Using gitea's npm registry, I've noticed that my packages will not be installed correctly, because the scripts specified in the package.json are not executed.

I believe the root cause is that missing metadata results in npm not knowing a package specified those installation scripts. Specifically, gitea's metadata does not specify the tag hasInstallScript (npm metadata documentation).

This issue resembles #21303 quite a bit in that sense.

After having npm install-ed a package, the scripts are not run. However, running the command npm run postinstall (or any other installation script specified in a given package.json) after will result in the execution of the relevant script.

Gitea Version

1.17.3

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?

docker

Database

PostgreSQL

Originally created by @patricwi on GitHub (Oct 28, 2022). ### Description npm allows packages to specify installation scripts that are executed in a given life-cycle order, as specified in [the npm documentation](https://docs.npmjs.com/cli/v9/using-npm/scripts) Using gitea's npm registry, I've noticed that my packages will not be installed correctly, because the scripts specified in the `package.json` are not executed. I believe the root cause is that missing metadata results in npm not knowing a package specified those installation scripts. Specifically, [gitea's metadata](https://github.com/go-gitea/gitea/blob/main/modules/packages/npm/metadata.go) does not specify the tag `hasInstallScript` ([npm metadata documentation](https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md)). This issue resembles #21303 quite a bit in that sense. After having `npm install`-ed a package, the scripts are not run. However, running the command `npm run postinstall` (or any other installation script specified in a given `package.json`) after will result in the execution of the relevant script. ### Gitea Version 1.17.3 ### 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? docker ### Database PostgreSQL
GiteaMirror added the topic/packagestype/bug labels 2025-11-02 08:48:31 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9749