In my new project created using the command:
npm init
I want do add dependency from another GitHub project, so I used command:
npm install https://github.com/cichy380/prefixData.git --save-dev
but I got error:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: git+https://github.com/cichy380/prefixData.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
Can you explain me why?
To add your existing project to GitHub, follow the below steps, Create a Github account. Once logged in, click on the + icon on the extreme right corner and select New Repository Here you need to provide the name and description of your repository and also the permissions (Public/Private) which is self explanatory.
On GitHub.com, navigate to the main page of the repository. Under your repository name, click Insights . In the left sidebar, click Dependency graph . Optionally, under "Dependency graph", click Dependents . Dependencies are grouped by ecosystem. You can expand a dependency to view its dependencies.
You can add an existing Git repository to GitHub using GitHub Desktop. Using the command line, remove any git remotes currently configured for the repository.
First choice: Use an appropriate build/dependency tool instead of git A dependency management tool is my current recommended way forward to handle the growing pains and the build times of sizeable projects. Keep your modules separated in individual repositories and manage their interdependency using a tool built for the job.
I believe I can answer your question "Can you explain me why?"
Given the limited information in the question no one can for certain tell you the root cause of your error, but it COULD be one of these reasons:
package.json
in your repository; OR
In your question you say that you executed the command:
npm install https://github.com/cichy380/prefixData.git --save-dev
This is not a valid npm package git url format. It's possible that if you used the protocol git+https
you will not get that error, like so
npm install git+https://github.com/cichy380/prefixData.git --save-dev
I'm not sure if that's valid across all npm versions, but as you will see in the npm package docs link it does not allow for just https
protocol; OR
Two reasons I can't say for certain 2 is your problem is ONE, not sure what version npm package you're using and what npm versions obey the docs I provided as a link and TWO your error you provided includes the git+https
protocol so thats confusing:
npm ERR! package.json Non-registry package missing package.json:
git+https://github.com/cichy380/prefixData.git.
Hopefully this helps someone!
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