I'm trying to install a package that exists on our private repo. The goal is to share the repo with a partner, but I need to make sure they can install it. In theory, it should work, but none of the documented solutions are working for me
I've tried adding the package to the package.json file
"dependencies": {
"package_name": "git+https://<deploy-token-name>:<deploy-token>@gitlab.domain.com/group/repo.git"
}
And then installing with npm but it seems to fail on the deploy token, but it's hard to say because the log isn't very helpful and then our whole gitlab deployment goes down for a moment #fun
29 error
29 error undefined
29 error exited with error code: 128
I've also tried with a private access token
"package-name": "https://oauth2:<access-token>@gitlab.domain.com/group/repo.git"
This results in an actual error that I can understand, except the error is saying there isn't a package.json in the repository, but there most certainly is
npm ERR! package.json Non-registry package missing package.json: package-name@https://oauth2:<access-token>@gitlab.domain.com/group/repo.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
I've tried with ssh (with a ssh key setup that works for commits etc)
git+ssh://[email protected]:my-project/my-repo#my-branch
And that results in an error
npm ERR! premature close
I've read through a dozen related issues and articles, but nothing is working for me
With npm private packages, you can use the npm registry to host code that is only visible to you and chosen collaborators, allowing you to manage and use private code alongside public code in your projects. Private packages always have a scope, and scoped packages are private by default.
Install the dependencies to the local node_modules folder. In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package. By default, npm install will install all modules listed as dependencies in package. json .
To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.
I've got the same issue and I managed to fix it.
The gitlab repository that I wanted to install didn't have a package.json
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With