felps321
felps321

Reputation: 388

How to imitate my library is a node module without uploading to the NPM?

If I'm developing a library which work is based a lot around of current working directory and the filesystem generally, a lot of paths resolution, and I want to see how it will behave when will be installed as a node module, I don't want to get unexpected results when I'll upload it to the npm. How do I test my library behavior pretending it's a node module? Is placing its folder in node_modules enough?

Upvotes: 2

Views: 586

Answers (1)

Raeisi
Raeisi

Reputation: 2171

Make a local package and install it everywhere:

$ npm pack

it will generate a zipped file, so you can copy somewhere and install it.

// another project
$ npm install /path/to/pack

Resources: npm pack, Add local package

Absolutely you can use npm link too. link

Upvotes: 2

Related Questions