shama / napa

:wine_glass: A helper for installing stuff without a package.json with npm.
MIT License
413 stars 34 forks source link

Trouble installing a dependency that uses napa #69

Open RichardMarks opened 8 years ago

RichardMarks commented 8 years ago

I have a two projects, A and B for brevity.

project A uses napa to install dependencies from github

project B installs project A as a dependency

the install fails if project B does not have napa installed as well, which means that project B needs to "know" about project A's dependency on napa in order to use it.

Is there a way to resolve this?

shama commented 8 years ago

The names of the actual projects would help. napa doesn't do anything fancy, it just git clones a repo. So if project A uses napa then it should have napa in it's install script or include the napa installed package in the published package.

RichardMarks commented 8 years ago

Both projects A and B are locally developed, their names are not relevant in this case.

In the package.json for project A, there is a script hook "postinstall": "napa" and a "napa" section where I bring in my dependencies.

I then locally publish project A as an npm module using npm link

and then in the package.json for project B, I install my local npm module.

When that hits the "postinstall" script, project B fails to install project A, because it cannot find napa.

If I npm install napa in the project B directory, then project A will install into project B.

I do not want project B to have to know that it needs napa in order for project A to be installed.

shama commented 8 years ago

When that hits the "postinstall" script, project B fails to install project A, because it cannot find napa.

Is napa a dependency? If your package requires another to install, it will need to be a dependency of that project.

linkabi9 commented 8 years ago

@RichardMarks did you get this resolved? I want to do something similar and I'm wondering if I should avoid it. Did adding napa to the dependencies block of the Package A help?

RichardMarks commented 8 years ago

@linkabi9 No, I did not get this resolved, and no adding napa as a dependency does not help either.

shama commented 8 years ago

@RichardMarks @linkabi9 Here is an example: https://github.com/shama/napa-nested-deps

linkabi9 commented 8 years ago

great, i'll be able to use this while i build some in house front end widgets with pre-npm external dependencies. thanks!