-
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
yarn global install installs package under nodejs node_modules instead of appdata node_modules #1491
Comments
Good catch... We shouldn't try writing to c:\Program Files\nodejs as the user probably doesn't have permission to write files there (unless running Yarn with admin rights) |
Hello ! Is there a reason why yarn isn't using the result of On Windows, npm is installing global modules in |
I agree. I am an administrator on my laptop, but my work has my prefix set to %APP_DATA%\npm. NPM installs packages global packages to this location. Yarn should read this prefix to know where to install. |
I'm not sure Yarn should care about npm's config. Maybe it's good as a fallback, but Yarn should probably have its own way of configuring this,
It should really be using %LocalAppData% :) |
Doesn't yarn have to care if it is installing global npm packages? If yarn does not install the npm package where npm is configured to look for global packages them npm won't be able to run the package. |
Why would npm be looking for the package? Global packages just need to be on the |
Maybe I am confused about what yarn is doing. I thought it was giving users a quicker, more streamlined, single way to install packages by searching multiple registries for you such as npm and bower. If the package that you are trying to install is an npm package then yarn would download the package from the npm registry and install that package where npm is configured to install? Am I correct? If so, doesn't that tie yarn to each registry. If not, the documentation is not clear to me that yarn is installing these packages to a yarn configured location. |
While Yarn uses the same registry as npm, it is a separate app from npm, and does not use the npm client at all. This means you can use Yarn on a computer that does not have npm installed, it just requires node.js. For local packages (ie. packages used by your app), Yarn installs them into For global packages (ie. packages that you want to use at the system level, not specific to any particular project), Yarn stores those in its own directory. These do not need to be in any particular location as you should not be In general, any packages or apps used by your project should be installed as local packages, not global. The only global packages that should be installed are those that are not specific to any one project. The main example of this are apps used for scaffolding new projects (for example, Yeoman or create-react-app). Using global packages introduces global state, and like global variables they should be used very sparingly. If your project uses an npm package with an executable (say something like Webpack, Gulp, etc), you do not need to install it globally. Instead, run the executable from Does that help? |
This does help. I had encountered my original issue trying to install the angular-cli globally to be able to scaffold new projects. |
Is this the reason |
Is there a way I can configure the global prefix for Yarn, to make it install in I am asking, because I just installed |
There is a similar problem on Ubuntu after 'yarn global add gulp'... |
Looks like it is still an open issue. Any progress on it? |
globals should read in the node path and install to the node_modules at that location. |
check |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
On Windows when performing a "yarn global install " the install is downloaded to the "C:\Program Files\nodejs" node_modules folder instead of the "C:\Users[Username]\AppData\Roaming\npm" node_modules folder.
If the current behavior is a bug, please provide the steps to reproduce.
yarn global install
What is the expected behavior?
On Windows when performing a "yarn global install " the install is downloaded to the "C:\Program Files\nodejs" node_modules folder instead of the "C:\Users[Username]\AppData\Roaming\npm" node_modules folder.
Please mention your node.js, yarn and operating system version.
Node: v6.9.1
npm: v3.10.8
yarn: v0.16.1
Windows 7 Enterprise
The text was updated successfully, but these errors were encountered: