How do you reference a NodeJS module in a Git subd...
# typescript
s
How do you reference a NodeJS module in a Git subdirectory with
npm
? The only solution I’ve found so far seems to be switching to
yarn
at all. (see https://github.com/npm/npm/issues/2974 -> https://npm.community/t/allow-installing-packages-from-git-subdirectories/3973)
Use-case: I’ve changed sth. to
pulumi-kubernetes
where the module resides in the
sdk/nodejs
subdirectory. Locally it works fine with
npm install ../github.com/pulumi/pulumi-kubernetes/sdk/nodejs
. But now I want to make it accessible for other before my (possible) contribution (may) get merged & released upstream. Therefore I want to deliver the changes in a company-internal fork. Then I get to the problem above:
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t git://github.com/ORG/pulumi-kubernetes/sdk/nodejs
npm ERR!
npm ERR! fatal: remote error:
npm ERR! ORG/pulumi-kubernetes/sdk/nodejs is not a valid repository name
npm ERR! Email support@github.com for help
f
Could you publish the package to an internal repo or private npm org? Note: you would have to update the name and version. Also, you could create another repo that includes just the code in the nodejs folder at the root and it should work since node assumes that the package is at the root.
s
@future-barista-68134 I wanted to keep it as simple as possible. Didn’t publish to npm.org by myself. I might move the
./sdk/nodejs
folder to root in the fork. That way I hopefully can synch with upstream.
👍 1