Skip to content

[RRFC]: Add "requireGlobal": true field to package.json for global-only packages #894

@alexsch01

Description

@alexsch01

In my package's package.json file, I have preinstall that looks like

"scripts": {
    "preinstall": "node scripts/preinstall.js"
}

currently, i have preinstall.js script that looks like

if(!process.env.npm_config_global) {
    console.log('This npm module can only be installed globally')
    process.exit(1)
}

npm 12 will make install scripts opt-in (see #868)


is there a possibility of adding a field to package.json file that replicates this behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions