I'm listing a github repository (TypeScript project if it matters) as a dependency in package.json:
"ethereumjs-vm": "git+https://github.com/ethereumjs/ethereumjs-vm.git#v4.0.0-beta.1"
I want to extend some of the classes of this public project in my own project. With yarn install
the whole repository gets checked out/copied (not a real git clone, since I can't run git commands) into node_modules/ethereumjsvm
which is fine.
With npm install https://github.com/ethereumjs/ethereumjs-vm/tarball/v4.0.0-beta.1 --save
the code gets checked out too.
With npm install
I only get 4 files in node_modules/ethereumjsvm
: changelog, license, package.json and readme.
What's the difference? Why does npm install
does not get the source code from the repository?
Aaron Bell provided me with the answer: The files
property in the package.json
of the github project I want to include only contains the dist
folder:
"files": [
"dist/**/*"
]
This means npm install
will ignore all other files in the repository (except changelog, license, package.json and readme which are always installed, see package.json files docs ). yarn
seems to have a bug where this files
property is ignored ( issue ).
After this I tried npm install
with a project from github without a files
property in package.json
and it worked - the source code was stored in node_modules
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.