Differences vs npm
Unlike npm, pnpm validates all options. For example,
pnpm install --target_arch x64 will
--target_arch is not a valid option for
However, some dependencies may use the
npm_config_ environment variable, which
is populated from the CLI options. In this case, you have the following options:
- explicitly set the env variable:
npm_config_target_arch=x64 pnpm install
- force the unknown option with
pnpm install --config.target_arch=x64
-C <path>, --dir <path>
Run as if pnpm was started in
<path> instead of the current working directory.
Run as if pnpm was started in the root of the workspace instead of the current working directory.
For more information, see the documentation for individual CLI commands. Here is a list of handy npm equivalents to get you started:
npm i <pkg>
pnpm add <pkg>
npm run <cmd>
When an unknown command is used, pnpm will search for a script with the given name,
pnpm run lint is the same as
pnpm lint. If there is no script with the specified name,
then pnpm will execute the command as a shell script, so you can do things like
pnpm eslint (see pnpm exec).
Some environment variables that are not pnpm related might change the behaviour of pnpm:
These environment variables may influence what directories pnpm will use for storing global information:
You can search the docs to find the settings that leverage these environment variables.