I'm trying to build a node library that will be stored into a .tgz
The issue is when I install this lib in another npm project, I have an error:
Non-registry package missing package.json: easy-rules-core@file:/Users/sbuisson/.m2/repository/org/jeasy/easy-rules-core-js/3.2.4/easy-rules-core-js-3.2.4.tgz.
The file structure of my tgz:
easy-rules-core-js-3.2.4.tgz
-> package
->package.json
->index.js
->node_modules
I've also tried without success:
easy-rules-core-js-3.2.4.tgz
->package.json
->index.js
->node_modules
Where should I put the package.json?
Bonus question: Do I need to put the node_modules folder into the tgz?
Try the npm pack
command in your project folder. It should create a .tgz file structured correctly. It should be something like this (without the node_modules
folder):
easy-rules-core-js-3.2.4.tgz
-> package
->package.json
->index.js
Then copy the .tgz file in your parent module's root folder and run:
npm install ./easy-rules-core-js-3.2.4.tgz
.
This will handle the installation while adding the following line to your package.json:
"easy-rules-core-js": "file:easy-rules-core-js-3.2.4.tgz"
. Alternatively you can add the dependency manually to the package.json.
More information:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With