sindresorhus / guides Goto Github PK
View Code? Open in Web Editor NEWA collection of succinct guides - Public Domain
A collection of succinct guides - Public Domain
I've tried to remove sudo for installing npm_packages using https://github.com/glenpike/npm-g_nosudo.
I've used wget.
And I think it removed all my packages and reinstalled it. (I suppose).
And in the end I got this in the terminal:
....
- [email protected] node_modules/yo/node_modules/titleize
- [email protected] node_modules/yo/node_modules/update-notifier
- [email protected] node_modules/yo/node_modules/yeoman-character
- [email protected] node_modules/yo/node_modules/yeoman-doctor
- [email protected] node_modules/yo/node_modules/yeoman-environment
- [email protected] node_modules/yo/node_modules/yosay
- [email protected] node_modules/yo
sh: 74: [: npm: unexpected operator
sh: 77: [: npm: unexpected operator
npm ERR! fetch failed https://registry.npmjs.org/i/-/i-0.3.2.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 504
npm ERR! fetch failed https://registry.npmjs.org/i/-/i-0.3.2.tgz
npm WARN retry will retry, error on last attempt: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm ERR! fetch failed https://registry.npmjs.org/i/-/i-0.3.2.tgz
npm ERR! Linux 3.19.0-66-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "-g" "install" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]"
npm ERR! node v5.4.1
npm ERR! npm v3.10.5
npm ERR! fetch failed with status code 504
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/asim/npm-debug.log
Invalid choice
You may need to add the following to your ~/.bashrc / .zshrc file(s)
export NPM_PACKAGES="npm"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
export PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
export NPM_PACKAGES="config"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
export PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
export NPM_PACKAGES="set"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
export PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
export NPM_PACKAGES="prefix"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
export PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
export NPM_PACKAGES="$npmdir/.npm-packages"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
export PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
Done - current package list:
/usr/local/lib
`-- [email protected]
Then I copied the code from export NPM_PACKAGES="npm"
to export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
like said in the terminal message and I pasted it in bashrc and saved.
(sudo gedit ~/.bashrc
)
Then I source the bashrc
source ~/.bashrc
But still no packages are available. (gulp
, yo
etc)
Please help me!
I can provide more details.
I'm pretty sure no one knows how the tilde works regarding dependencies and patch releases in semver. Would be nice to have a place to refer too since I need to explain this multiple times a week.
This issue may/may not be more relevant here. Any advice?
After wget the sh file, no npm-cli command excuted.
Such as "yo" command shows "yo: command not found"
Im running UBUNTU 12.04 LTS
the low limit of 256 open file descriptors has caused so many problems. I need a canonical place to refer to when it comes up.
Should describe what, why, and how to increase both the soft and hard limit.
Might also apply to Linux, not sure.
I'm working with Ubuntu 20 and I required to run also newgrp docker
prior to see the groups configuration applied.
It really changed my life!
Not all the Linux distributions have the service
command.
For example in archlinux, this will not work:
sudo service docker restart
But this yes:
sudo systemctl restart docker
Globbing is used all over the place, but I've yet to find a nice intro guide for beginners.
Should include usage examples for common pattern combinations.
Need it for globby and multimatch.
Resources:
I haven't file $HOME/.npmrc
What I must to do?
Debian 9.7
Node 6.16.0
NPM 3.10.10
Using the Google Click to Deploy node.js application runtime on compute engine gives us a fresh instance.
As non-root user:
wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh | sh
source ~/.bashrc
npm install --global gatsby
gatsby --version
Expected outcome prints gatsby version
Actual result
-bash: gatsby: command not found
Using the original instructions provided here however do work.
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
The solution is not global, it is user-wide so global words should be replaced by "user-wide".
On my Mac OS 10.10.5 the settings from
https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md
still did not update the path, so I had to add this to my .bash_profile
:
export PATH=~/.npm-packages/bin:$PATH
Hi,
i tried everything you mention and cant find any other reason why i still cant run docker without sudo. Is there any other stuff that can prevent it from working without it?
Have any idea?
Hi, and thanks for the great collection.
I was wondering if there's a safety option against using 'rm -fr' ?
It seems that bash steps mentioned in "How not to rm yourself", and 'rm -i' is bypassed with this command.
export PATH=/usr/local/share/npm/bin:$PATH
Promised this a while ago but life got in the way. Leaving it here so I don't forget: https://twitter.com/sindresorhus/status/333555301305438210
I followed your guide "Install npm packages globally without sudo on OS X and Linux" on Mac which works perfectly. If I install something like $ npm i -g babel
I can now use the babel
command. However I tried updating npm itself with $ npm i -g npm
, but I still use the old sudo-ed version of npm, not the version inside .npm-packages
. Is there a nice way to use the not-sudo-installed npm version and fallback to the sudo-installed npm version, if necessary?
Hey, I was running through "Install npm packages globally on Linux without sudo" on a debian machine earlier.
For some reason, exporting a path with ~
wasn't working as a path and we've had to replace it with $HOME
instead.
I don't know if this is a frequent problem - but it might make sense to update to remove the tilde path notation?
Need to have this guide so I can link to it from sudo-block.
Or as @kevva said it:
how to not sudo your way out
There's lots of potential guides on in the wild web about setting up nginx, but they're not generic enough for maintainability across different environments and sites, and the thought of security—like proxy, load balancing, etc.
It would be nice to have guides such as
How to save a bookmarklet. This is especially hard on Mobile Safari. Would be nice to have something to refer to when creating bookmarks.
https://docs.npmjs.com now contains the information and a screencast on how to fix npm
's permissions.
nvm says:
$ nvm install 8
Downloading and installing node v8.9.4...
Downloading https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz...
######################################################################## 100,0%
Computing checksum with sha256sum
Checksums matched!
nvm is not compatible with the npm config "prefix" option: currently set to "/home/niko/.npm-packages"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.9.4` to unset it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.