How to install a subdirectory as package?

(Cyril Auburtin) #1

I’d like to install a subdirectory of a git repo:

For example I’d like to do:

npm i -D github:caub/create-react-app/tree/eslint/packages/react-scripts#eslint
# or the equivalent:
npm i -D git+ssh://

It’s not working, but this is a git issue, not an npm issue

npm ERR!   fatal: remote error: 
npm ERR!      caub/create-react-app/tree/eslint/packages/react-scripts is not a valid repository name

I’ve seen: that suggests a feature like

npm i -D github:caub/create-react-app#eslint?path=packages/react-scripts

Does something like that already work? It’s necessary to have this feature

1 Like
(John Gee) #2

You can do this with npm packages, not sure about git links:

(Cyril Auburtin) #3

Thanks @shadowspawn, the package has this directory field set up:

My question is how could I install it from its github link, not from npm? It’s a pending PR, not merged yet

1 Like