Page cover

Environment

This section will show you how to configure your shell environment on nix-like systems (Linux, macOS) to allow you to invoke not just nr, but any project-local Node executable directly from the command line while in the project directory.

To accomplish this, you will need to make a modification to the $PATH environment variable in your shell's startup script. This is typically a file like ~/.bashrc or ~/.zshrc. The file name will vary depending on what shell you use, but the concept will be the same.

Open this file in an editor and add the following line at a place of your choosing:

export PATH="$PATH:$(npm bin)"

This will append the local ./node_modules/.bin folder to the list of paths that your shell will check when looking for an executable.

Save this file and open a new terminal, where these changes will be applied.

Now, you should be able to invoke the CLI of any Node packages you have installed in a project directly from the command line.

To verify that your shell is using the local version, you can use the which utility:

which nr

If for any reason you don't want to modify your $PATH., you can still install nr locally and invoke it using npx nr. For more information, refer to the npx documentation.

Last updated