Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install git repository without package.json

Tags:

git

npm

I have a project that depends on several third-party libs.

My package.json looks like:

"dependencies": {     "vendor-name": "git://github.com/vendor/name.git#v1.1",     ... } 

This works as long as the vendor-name repository contains a package.json.

If there's not such a file, I get:

npm ERR! path /var/folders/0l/temp-folder/package.json npm ERR! code ENOENT 

Actually, a npm install git://github.com/vendor/name.git#v1.1 does not work, too.

So my question is: Is there a way to install (include) git repositories (in the dependencies) that do not have a package.json?

like image 811
Marc J. Schmidt Avatar asked Feb 28 '13 18:02

Marc J. Schmidt


People also ask

Does npm need package json?

All npm packages contain a file, usually in the project root, called package. json - this file holds various metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.

Can you install Git with npm?

npm install git doesn't install git (i.e. the command line tool to manipulate git repositories). It installs the npm package called git which seems to be a JavaScript library to interact with git repositories (which makes the name accurate, but still misleading). npm is not a general-purpose package manager.

Should you include package json in git?

To recap, you should always include both package. json and package-lock. json in your source control. Thus, never put them in the .


1 Answers

Yes you can with this package: https://npmjs.org/package/napa

like image 135
cyberwombat Avatar answered Sep 23 '22 02:09

cyberwombat