Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output all licenses of installed node.js libraries

Tags:

node.js

npm

Is there an option in npm (or other tool) to print all used licenses? I have a project and I want to make sure I don't use a library which is under a license I can't use.

EDIT: Found out that many developers don't include the license in the package.json, so I had to find out manually using "npm docs package-name"

like image 518
whadar Avatar asked Apr 29 '13 09:04

whadar


People also ask

What is the license of NPM packages?

npm is released under the Artistic License 2.0, subject to additional terms that are listed below. Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Are all NPM packages open source?

The npm Registry is a public collection of packages of open-source code for Node. js, front-end web apps, mobile apps, robots, routers, and countless other needs of the JavaScript community. npm is the command line client that allows developers to install and publish those packages.

Where are node js libraries stored?

Global libraries On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node.

Are all NPM packages free to use?

NPM provides a vast amount of packages to make our development fast and easy. Even though these dependencies are free and editable, they have licenses bound to protect them in different means. Besides, these licenses state the terms, conditions, and warranties applicable to a specific package.


1 Answers

I had exactly the same requirement, and wrote a node module to do this. Shameless self promotion I know, but it is open source and hope it can help resolve your issue. Let me know if you have any issues or suggestions.

The difference over the other answers is that it does not just use the package.json license declaration, but looks for potential license information in license and readme files in the project.

https://npmjs.org/package/nlf

You can install using npm install -g nlf

like image 87
iandotkelly Avatar answered Sep 20 '22 11:09

iandotkelly