Skip to content

npm RFC #868 will block this package's install script by default #3061

Open

Description

@JamieMagee

Hi there,

I'm reaching out because grpc is one of the most depended-on npm packages that runs an install script, and an accepted npm RFC is going to change how those scripts behave.

The RFC blocks dependency install scripts by default during npm install. That's the same thing pnpm, Yarn Berry, Bun, and Deno already do. Users opt back in per package through a new allowScripts field in package.json (or the npm approve-scripts command). The motivation is the run of supply-chain attacks over the last couple of years that used postinstall hooks to run code the moment a package landed in the tree.

For grpc, the script that's affected is:

"install": "node-pre-gyp install --fallback-to-build --library=static_library"

That script compiles a native addon, so under the new default it won't run unless the user adds grpc to their allowScripts. The change that helps your users most is shipping prebuilt binaries as optionalDependencies, the pattern esbuild, sharp, and @swc/core moved to. Most installs then need no compile step and no allowlist entry. If prebuilds aren't practical for grpc, a short note in your README showing the allowScripts line people should add will save a lot of confused issues.

I wanted to flag this early so you've got time to plan rather than find out when the install warnings start showing up. The full RFC is here: npm/rfcs#868. Happy to answer any questions.

Activity

  1. murgatroid99 commented on Jun 2, 2026

    @murgatroid99
    Member

    The grpc package has been deprecated for 6 years, and is unsupported.

  2. samuelmurray commented on Jun 26, 2026

    @samuelmurray

    I think the same is true for grpc-tools, which also has a script block with install that runs node-pre-gyp install.

    EDIT: see also #2967

  3. aaltat commented on Jul 13, 2026

    @aaltat

    The grpc-tools and grpc-tools dependency fsevents suffer from the npm 12.x decision to block install script. With Node: 26.5.0 and npm: 12.0.1, I see the following when installing grpc-tools:

    pm warn install-scripts 2 packages had install scripts blocked because they are not covered by allowScripts:
    npm warn install-scripts   grpc-tools@1.13.1 (install: node-pre-gyp install)
    npm warn install-scripts   fsevents@2.3.2 (install: node-gyp rebuild)
    npm warn install-scripts   protobufjs@7.6.5 (postinstall: node scripts/postinstall)
    npm warn install-scripts
    npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.

    This is caused be change in node and post install script are not anymore allowed by default. There is migration guidance in https://installsafe.dev/ It would be nice if grpc-tools it self would not require post install script. Also it would be nice if fsevents dependency would be updated (in some way) that it would not require post install scripts. Updating protobufjs to the 8.5.x seems to resolve this problem.

  4. murgatroid99 commented on Jul 17, 2026

    @murgatroid99
    Member

    Those warnings are coming from more than just grpc-tools, because grpc-tools does not have a transitive dependency on either protobufjs or fsevents.

    The issue with grpc-tools is that currently, node-pre-gyp allows us to install only the binary that is appropriate for the current platform and architecture. The only alternative I can think of is to include all of the binaries in the package, and select the appropriate one at runtime. Unfortunately, this will make the install size about 25 MB, which is pretty big. If that's the only reasonable option, I'll do it, but it would be good to know if there are good alternatives that don't use an install script.

  5. JamieMagee commented on Jul 17, 2026

    @JamieMagee
    Author

    @murgatroid99 you don't need to include all the binaries in the package. The best approach is to publish separate packages for each supported architecture, and include them as optionalDependencies in the main package. For examples see esbuild and @esbuild/linux-arm64, @esbuild/win32-x64, @esbuild/darwin-arm64, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions