Categories
JavaScript Answers

How to specify path to node_modules in package.json with Node.js?

Spread the love

To specify path to node_modules in package.json with Node.js, we set the NODE_PATH environment variable.

For instance, we run

export NODE_PATH=/your/dir/node_modules

to set the NODE_PATH to the /your/dir/node_modules folder to specify that as the package folder for the project.

Then when we run our app, the packages will be imported from this folder.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *