1

I want to install @nuxtjs/axios, but from my fork

url - https://github.com/BjornMelgaard/modules

branch - axios_vue_overlap_fix

package name - @nuxtjs/axios

what command should I use?

Community
  • 1
  • 1
srghma
  • 4,770
  • 2
  • 38
  • 54
  • Why do you have the [tag:yarn] tag? Do you want to use the yarn CLI specifically? – E_net4 Jul 25 '17 at 13:15
  • generally yes, I hoped that commands for them would be similar – srghma Jul 25 '17 at 13:38
  • Please make your intent clearer, otherwise it is a duplicate: https://stackoverflow.com/q/17509669/1233251 – E_net4 Jul 25 '17 at 13:41
  • @E_net4 I had thought it might be a dupe, too, but I wanted to research the potential difference in installing a _scoped_ package from GitHub. Turns out there isn't really one, but you still have to jump through a few hoops for this specific project. – msanford Jul 25 '17 at 13:44
  • I had also interpreted the inclusion of both tags as "I'll accept an answer in either", so I provided only an `npm` solution. Perhaps it will be helpful anyway. – msanford Jul 25 '17 at 13:45

1 Answers1

0

EDIT: This question originally had both npm and yarn tags. I'll leave this in case someone else finds it useful.

As far as I understand, npm maps GitHub packages to repository roots. Since the nuxtjs "modules" repository appears to be pile of largely-independent packages, you might have to jump through some hoops.

I got it working this way.

Install your whole fork, note the git+https syntax, and the branch identifier # following the repo URL:

npm install git+https://git@github.com/BjornMelgaard/modules#axios_vue_overlap_fix

Then npm install the dependencies of the axios module (because of the repo structure, npm will not do this for you):

cd node_modules/@nuxtjs/modules/modules/axios && npm install

And require it like so:

const axios = require('@nuxtjs/modules/modules/axios')
msanford
  • 11,803
  • 11
  • 66
  • 93
  • its sad that I cannot install scoped package without changing project code – srghma Jul 25 '17 at 13:49
  • @bjornmelgaard Do you mean that you need the extra steps? It's not _because it's scoped_ I think. It's because the module exists within a larger repo as a sub-folder rather than as its own repo. There's no requirement that scoped packages live all under the same repo, but it's probably easier for nuxt team to manage that way. – msanford Jul 25 '17 at 13:51
  • yes, but I install packages separately (only `@nuxtjs/axios` in package.json, not whole `@nuxtjs/modules`), and with your approach I have to install all `@nuxtjs/modules` and then pick modules that I need, by changing project code – srghma Jul 25 '17 at 14:01
  • @bjornmelgaard Yes, that's because of _the structure of the nuxtjs repository_. If they had made individual repositories for each module you wouldn't need to do that. It's just how `npm` works. `yarn`, however, may be different. – msanford Jul 25 '17 at 14:06
  • why npm/yarn cant just accept path to module's package.json and figure out all other things by itself? – srghma Jul 25 '17 at 14:11