Giter VIP home page Giter VIP logo

npm-g_nosudo's Introduction

npm-g_nosudo

A shell script which will fix the problem where you want to stop using sudo for npm -g on Ubuntu.

Inspired by a day trying to sort various machines out on our system to run code nicely.

and this Stackoverflow answer

Tested on Ubuntu 14.04 with Bash

Usage:

Download the script, run it:

./npm-g-nosudo.sh

or

wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh | sh

If you run the former command (rather than the wget version), the script will give you the option to fix your .bashrc or .zshrc file(s) automatically to use the settings from Sindre Sorhus' Guide

If you say "n", it will print the variables you need to enable you to fix manually.

If you say "y", you will need to source your corresponding file for your current environment vars to be updated.

If you run the command via wget, this changes the stdin for the script, so it doesn't run interactively and won't update your file. It will echo out the variables you need to set near the end of the script output so you can copy these and add this to your environment manually.

Important

After updating your environment files, you will need to source the corresponding file before your npm binaries will be found in the current terminal session, e.g. for bash:

source ~/.bashrc

or just open an new terminal session.

The script may not play nicely with Node Version Manager so it will not run if if finds the script installed.

License

MIT © Glen Pike

npm-g_nosudo's People

Contributors

glenpike avatar anteriovieira avatar javadoug avatar pgilad avatar jimvanderveen avatar diokey avatar bryant1410 avatar austinbutler avatar nshtg avatar

Watchers

James Cloos avatar  avatar

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.