Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use different filename for npm than "package.json"

Is there a way to tell npm from the command line to use a different file than "package.json"?

Edit:

Thank you for your answers. I already checked the docs and hoped there was a workaround or a non-documented way to achieve that. I'll think of something else then.

like image 742
Robert M. Avatar asked Sep 23 '14 09:09

Robert M.


1 Answers

Using only client-space tools, it seems pretty straightforward you can't. npm doc is positive about this :

A package is: 
    a) a folder containing a program described by a package.json file
    b) a gzipped tarball containing (a) 
    c) a url thatresolves to (b) 
    d) a <name>@<version> that is published on theregistry with (c) 
    e) a <name>@<tag> that points to (d) 
    f) a <name>that has a "latest" tag satisfying (e) 
    g) a git url that, when cloned,results in (a).
[...]

You need to have a package.json file in the root of your project to do much of anything with npm. That is basically the whole interface.

source : npm doc

As you can see, they make it really clear a package.json is required for anything to work.

You'd have to dig into the code, for a result which would not be reusable. If it's what you want, please make it clear in your question for others to understand why it's necessary.

like image 179
sdumetz Avatar answered Sep 27 '22 20:09

sdumetz