-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to set the global install path #630
Comments
It's not currently supported but we can definently add an option. |
This is a really important feature and a must have IMO. So +1. |
If you install node to a user-owned location and set your own PATH, this already appears to work. I always unpack node to a place like |
This feature is very helpful for people who are unable to (or merely inclined against) running package installation operations, which sometimes download and execute staggering amounts of code of questionable provenance, as root. |
The npm option here is |
Rather than pass an option to npm, I have |
Notice that you can already add |
Instead of adding another directory to my |
#1600 might also be related |
Created #1654 to fix this, pending approval. |
Linked PR makes it possible to do: $ yarn global add react-native-cli --prefix /my-custom-prefix |
What would be the correct way to make such a prefix permanent? Is there a line we can add to |
* master: (66 commits) Add --no-bin-links flag - fixes yarnpkg#929 (yarnpkg#1651) Add option to change the prefix of the global bin folder - fixes yarnpkg#630 (yarnpkg#1654) patterns -> filteredPatterns Add helpful nudge to yarnpkg/rfcs on issue template (yarnpkg#1650) Change reporter.log to console.log in generate-lock-entry command - fixes yarnpkg#644 (yarnpkg#1652) Fixed add command flag (yarnpkg#1653) Nested executables fix (yarnpkg#1210) Added short-flags for yarn add (yarnpkg#1618) Add name lookups to ls command - fixes yarnpkg#1599 (yarnpkg#1643) Disable flaky secureUrl test (yarnpkg#1644) Add unit tests for `yarn why`. (yarnpkg#1544) Refine flow type for config.generateHardModulePath (yarnpkg#1642) Use ~/Library/Caches as default cache location on OSX - fixes yarnpkg#1637 (yarnpkg#1638) Update aliases.js (yarnpkg#1635) Update aliases.js (yarnpkg#1634) Add webhook to archive AppVeyor build artifacts (yarnpkg#1631) Attempt to fix failing Circle CI builds (yarnpkg#1629) Adding 'yarn global upgrade'(Issue yarnpkg#776) (yarnpkg#1616) Show error message in stdout. (yarnpkg#1502) Nicer permission errors when trying to write global binaries - fixes yarnpkg#1578 (yarnpkg#1592) ...
It should get the default npm path:
You can run this insted
|
@tadeugr If your comment was in reply to my question, it doesn’t answer it. The question was about making a custom path the default without having to continuously use The answer is |
@vitorgalvao you can play around with it. For example, I put this in my .bashrc file:
|
Any news on your question @vitorgalvao? |
@vitorgalvao Oh, I thought that was a wish, not the answer. Thank you. |
having to define PREFIX as a global environment variable is absolutely not a solution, because that variable used by many programs to define other things, for example make. |
It absolutely is a solution. It deliberately works! Is it a good solution? No. But I mentioned that in the next sentence:
I don’t think this is the place to have that discussion, though. For all intents and purposes this issue is solved and closed. Having a better global variable should be its own specific issue. |
It seems that |
Thank you @TimvdLippe. Definitely the right approach. |
@TimvdLippe thanks, this worked. But if you have some pre-installed packages from npm in the folder, |
@bastilimbach That's expected behaviour. Yarn is looking somewhere else for global packages once you changed the place where global packages get installed. Thanks @TimvdLippe, that was definitely the solution we were looking for! |
@nachoaIvarez I fixed it by removing all packages and adding them back with |
not works with 0.21.3 on macOS |
@TimvdLippe After setting the prefix it does work but the actual node_modules are still installed in AppData\Local\Yarn\config\global\node_modules. The prefix folder just contains the .cmd files. Is there anyway to change the actual install directory? |
This is the only reason why I have not switch to yarn, I need to install my front end packages in a specific folder. |
This is a feature (or perhaps documentation request).
When I run the following:
yarn global add create-react-app
Yarn will try to symlink into
/usr/bin
which requiressudo
. With NPM, I've set my global packages to install into a user directory that is then added to my$PATH
.Is it possible to set a global directory via config somehow?
I've tried the following to no avail:
yarn add create-react-app -g --global-folder ~/bin
(installs into~/node_modules
)yarn global add create-react-app --global-folder ~/bin
(still goes for/usr/bin
)This is all running on Debian 8.5
The text was updated successfully, but these errors were encountered: