Git Product home page Git Product logo

npm-install-peers's Introduction

NPM Install Peers

Software License npm

CLI command to install npm peerDependencies. This can be useful when developing modules.

Consider the following dependencies:

{
    "dependencies": {
        "react-router": "4.2.0"
    },
    "devDependencies": {},
    "peerDependencies": {
        "moment": "2.21.0"
    },
}

If you run this npm-install-peers command, moment will be installed because it's a direct peer dependency of your project. You'll still get a warning that react-router is missing a react peer dependency. You'll still need to install react yourself, this command only installs direct peer dependencies.

You probably don't need this package! It's generally a better idea to have your peerDependencies contents as devDependencies too.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Postcardware

You're free to use this package (it's MIT-licensed), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

The best postcards will get published on the open source page on our website.

Installation

npm install -g npm-install-peers

Usage

npm-install-peers

This will read out your package.json file and install all of its peerDependencies. There are no other options.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.

npm-install-peers's People

Contributors

adrianmrn avatar arpit1997 avatar brettz9 avatar dannyfritz avatar freekmurze avatar inad9300 avatar jehy avatar kheyali-mitra avatar m1guelpf avatar sebastiandedeyne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npm-install-peers's Issues

Utterly baffling UI

> npm-install-peers 

This package doesn't seem to have any peerDependencies

> npm-install-peers ajv-keywords

This package doesn't seem to have any peerDependencies

> npm-install-peers -h

This package doesn't seem to have any peerDependencies

> npm-install-peers --help

This package doesn't seem to have any peerDependencies

> npm-install-peers ajv-keywords

This package doesn't seem to have any peerDependencies

> npm-install-peers ajv

This package doesn't seem to have any peerDependencies

> npm-install-peers [email protected]

This package doesn't seem to have any peerDependencies

Not working with git

Hi! If I use this package with my project I has a problem. My package.json has a "git dependency" like this:

{
  "peerDependencies": {
    "package": "git+ssh://[email protected]/team/project.git"
  }
}

And npm-install-peers breaks.

Installed peers get to package.json in "dependencies" section when using npm 5

Installed peers get to package.json in "dependencies" section when using npm 5. This is likely related to npm 5 adding to "dependencies" even without "save" flag.

This can ve avoided with setting flag npm config set save false cbut setting this for user environment is wrong.

Also seems that we can use --no-save flag, I am gonna test it.

UPD. Looks fine, added a PR.

SyntaxError: Use of const in strict mode.

Does not work? I get this syntax error when executing npm-install-peers

$ npm-install-peers

C:\Program Files\nodejs\node_modules\npm-install-peers\index.js:4
const chalk = require('chalk')
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

throw new TypeError('must call as: npm.load(callback)') while runnint `npm-install-peers`

Our team and I have started getting the following error when we run npm-install-peers

/Users/kheyalimitra/code/pfm/node_modules/npm/lib/npm.js:130
      throw new TypeError('must call as: npm.load(callback)')
      ^
TypeError: must call as: npm.load(callback)
    at Object.load (/Users/kheyalimitra/code/pfm/node_modules/npm/lib/npm.js:130:13)
    at /Users/kheyalimitra/code/pfm/node_modules/npm-install-peers/dist/index.js:40:9
    at /Users/kheyalimitra/code/pfm/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

Our team uses npm version 6.14.1 not 7.x.x. We suspect that could be the issue hence added a fix.

Screen Shot 2021-02-02 at 3 03 40 PM
Let me know what you all think.
Thanks.

PR link:

#29

Allow --no-bin-links

I am using virtual machine on windows, and I can't have symlinks. I always install deps with --no-bin-links flag. Could you please add this option to npm-install-peers?

It would also be cool to allow passing other options which are used with npm install.

This package doesn't seem to have any peerDependencies

$ npm i
npm WARN @angular/[email protected] requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.

$ npm-install-peers
This package doesn't seem to have any peerDependencies

๐Ÿ˜ข

Make writing back to package.json optional

I was very surprised to see npm-install-peers modifying my files (package.json and npm-shrinkwrap.json) and leaving my Git working tree in a dirty state. Could the implementation of #4 be changed to allow not to modify any files?

add depency on npm

currently if i try to use npm-install-peers in an npm script, it fails because it's attempting to require npm but npm is not listed in your deps. setting it in your dependencies will fix this problem...

Add an option to only list peer dependencies

It would be useful if there was an option to list the declared peer dependencies (in a machine readable format like JSON) without actually installing them. This is similar to my npm feature request to extend npm list to support --only=peer, but even if implemented that would only work for already installed peer dependencies.

add some examples of successful and failed operation

currently the CLI doesn't provide a meaning error message. When I run it over a project with 6 peer dependency warnings it says: "This package doesn't seem to have any peerDependencies". This makes no sense and hence it is better you add some examples of successful and failed operation in the main guideline.

May I ask why you put "npm" in deps?

I saw it is added in #17

"dependencies": {
  "npm": "< 7.0"
}

This will affect package-lock.json extends for around 3K lines
I understand that with NPM 7, this package will no longer needed

exception on usage

npm-install-peers
module.js:471
    throw err;
    ^

Error: Cannot find module 'npm'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\spartanPAGE\AppData\Roaming\npm\node_modules\npm-install-peers\dist\index.js:5:11)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.