Can package.json enforce a dependency's global installation?

I’m looking for a way to configure my package.json so that a specific dependency is installed globally instead of locally. Every time I run my update command, all modules end up being installed in the local node_modules directory. I want to see if there is an approach or setting within the package configuration that can force a global installation for a dependency. For example, when I execute the following command:

npm refresh-deps

it still ends up installing packages locally. I’m interested in any ideas or workarounds to achieve global installation directly via package.json.

hey, no option in package.json forces a global isntall. u could add a postinstall script for that or just instruct users to install the dependency globaly manually.

Package.json itself does not offer any configuration option to trigger a global install and it is not even in line with npm’s design philosophy. The ecosystem expects dependencies to reside in the local node_modules directory unless specifically installed with the global flag through the command line. I have faced this limitation in projects in the past and worked around it by using custom scripts or documentation to notify team members to perform certain installations globally when needed. Thus, the best route is to use supplementary scripts or manual directions rather than expecting package.json to enforce global installation.