Reputation: 51
I created Angular library My-lib , and I'm trying to use it in my application My-app
but I don't want to publish it to NPM repo.
I tryied to do the npm link after I build My-lib npm link /folder/My-lib/dist/My-lib
and then in My-app folder npm link My-lib
But it didn't work, No package.json found
, so I did the npm link
on the root folder of the library
and from My-app folder npm link full-path-to/My-lib
, there I can see My-lib in the node-modules of My-app
but when I try to import it get can't find module.
Is there a way to do this , or maybe I'm not doing the npm link the right way !
Thank you
Upvotes: 1
Views: 4138
Reputation: 49
cd lib/dist/My-lib
npm pack
once the .tgz is created inside lib/dist/My-lib then just pack it. generally npm publish do the
npm pack
behind the scene before publishing this is the artifact that is actually used when do
npm i My-lib
so in package.json
under dependencies you can include like
... "My-lib" : --the path to your My-lib-0.0.1.tgz-- ...
like
"My-lib" : "../My-lib-0.0.1.tgz"
Upvotes: 0
Reputation: 81
cd lib/dist/My-lib
npm pack
npm install ../dist/My-lib/My-lib-0.0.1.tgz
Upvotes: 6