3

We have a package from private npm package store. Now we have source code of it and want to use the source code as local package to test something before pushing to repo in dev machine. How can I achieve it?

2

4 Answers 4

3

use npm link https://docs.npmjs.com/cli/link

Example from the docs cd ~/projects/node-redis # go into the package directory npm link # creates global link cd ~/projects/node-bloggy # go into some other package directory. npm link redis # link-install the package

Note that package-name is taken from package.json, not from directory name.

Sign up to request clarification or add additional context in comments.

1 Comment

we also need rebuild package and the host as well
1

Simply put it in a folder like __server-root/lib/<module-name> and require that folder instead of the npm module.

Comments

0

following up the answer of Enslev your require could look something like this:

const yourPrivateModule = require('./lib/<module-name>/index.js');

Comments

0

npm install /path/to/local/package

This has been answered before

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.