question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add separate command for completion install/uninstall (was: npm install mucks with preferences silently)

See original GitHub issue

I’ve got my home directory in git so I noticed something that I perceived to be wildly bad manners. When I npm install -g serverless it makes global changes to my .zshrc without asking. My rc file is configured for multiple machines and tailored to my needs, as I think it is for many people – having things haphazardly add themselves to it without my control feels invasive, IMHO*

The culprit lines of code that caused this are: https://github.com/serverless/serverless/blob/66f019b1f36af41dd067ac598244e97f98e1ead8/scripts/postinstall.js#L30-L31

The use of tabtab’s --auto flag is what I think is damaging. In auto mode, tabtab doesn’t place a standalone file in the completions folder for bash/zsh, it just haphazardly dumps code into the rc file.

Maybe I’m being overly sensitive about packages changing files outside of their scope in stateful manners and convenience is king. I just wanted to start a discussion about this to see if this was a valid concern or if I should continue “being weird” and write protecting my zshrc so that npm install doesn’t mess with it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:44
  • Comments:41 (16 by maintainers)

github_iconTop GitHub Comments

29reactions
zenlorcommented, Nov 27, 2017

User friendliness is important. But it doesn’t mean you need to spoonfeed your users. This is a tool for developers, I don’t think we need to have completion out of the box for a program without explicitly asking for it.

This tabtab thing is messy, it would add lines to my dotfiles either if I want or not. The best way to handle this is to explicitly ask your users to copy-paste completion snippets.

In my case, for example, I would add it to my ~/.zsh.local not in my ~/.zshrc.

Please don’t mess with user’s own files without the user’s input. It’s a bad user experience.

20reactions
Flygsandcommented, Oct 30, 2017

Maybe I’m being overly sensitive about packages changing files outside of their scope

I think many would consider it bad form, actually. @pmuens , have you guys considered offering completions as a separate node module, e.g. serverless-completions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm-install - npm Docs
This command installs a package and any packages that it depends on. If the package has a package-lock, or an npm shrinkwrap file,...
Read more >
npm install hangs - node.js - Stack Overflow
I made multiple iterations rerunning npm install --verbose , deleting the file at latest log path shown before a hang up. Finally installation...
Read more >
How to Install/Uninstall NodeJS on Ubuntu 18.04 - DigitalOcean
In our next step, we are going to run the command for installing NodeJS. Step 2: Install NodeJS on Ubuntu. After successfully adding...
Read more >
Install Node.js, npm, and VS Code - IBM Developer
In this tutorial, learn 3 different ways to install Node.js and npm, and the advantages and disadvantages of each. Also, see how to...
Read more >
Install Node.js modules - Bitnami Documentation
Using it, you can install, uninstall and search for Node.js modules. npm installs modules in two different scopes: local and global. Local installation....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found