yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

--modules-folder in .yarnrc does not work as expected #6404

Open sibh8 opened 6 years ago

sibh8 commented 6 years ago

Hello,

I am facing issue while using the .yarnrc file. Below is the tree structure of my repository

.
+-- angular.json
+-- build.gradle
+-- e2e
¦   +-- protractor.conf.js
¦   +-- src
¦   ¦   +-- app.e2e-spec.ts
¦   ¦   +-- app.po.ts
¦   +-- tsconfig.e2e.json
+-- package.json
+-- package-lock.json.bkp
+-- proxy-dev.json
+-- src
¦   +-- app
¦   ¦   +-- app.component.css
¦   ¦   +-- app.component.html
¦   ¦   +-- app.component.scss
¦   ¦   +-- app.component.spec.ts
¦   ¦   +-- app.component.ts
¦   ¦   +-- app.module.ts
¦   ¦   +-- app-routing.module.ts
¦   ¦   +-- components
¦   ¦   ¦   +-- form-question
¦   ¦   ¦   ¦   +-- form-question.component.html
¦   ¦   ¦   ¦   +-- form-question.component.scss
¦   ¦   ¦   ¦   +-- form-question.component.spec.ts
¦   ¦   ¦   ¦   +-- form-question.component.ts
¦   ¦   ¦   +-- page-controls
¦   ¦   ¦   ¦   +-- page-controls.component.html
¦   ¦   ¦   ¦   +-- page-controls.component.scss
¦   ¦   ¦   ¦   +-- page-controls.component.spec.ts
¦   ¦   ¦   ¦   +-- page-controls.component.ts
¦   ¦   ¦   +-- search
¦   ¦   ¦       +-- search.component.html
¦   ¦   ¦       +-- search.component.scss
¦   ¦   ¦       +-- search.component.spec.ts
¦   ¦   ¦       +-- search.component.ts
¦   ¦   ¦       +-- search.service..spec.ts
¦   ¦   ¦       +-- search.service.ts
¦   ¦   +-- models
¦   ¦   ¦   +-- transition-qualities.model.ts
¦   ¦   +-- pages
¦   ¦   ¦   +-- dashboard-page
¦   ¦   ¦   ¦   +-- dashboard-page.component.html
¦   ¦   ¦   ¦   +-- dashboard-page.component.scss
¦   ¦   ¦   ¦   +-- dashboard-page.component.spec.ts
¦   ¦   ¦   ¦   +-- dashboard-page.component.ts
¦   ¦   ¦   +-- engagement-page
¦   ¦   ¦   ¦   +-- engagement-page.component.html
¦   ¦   ¦   ¦   +-- engagement-page.component.scss
¦   ¦   ¦   ¦   +-- engagement-page.component.spec.ts
¦   ¦   ¦   ¦   +-- engagement-page.component.ts
¦   ¦   ¦   +-- qualities-page
¦   ¦   ¦   ¦   +-- qualities-page.component.html
¦   ¦   ¦   ¦   +-- qualities-page.component.scss
¦   ¦   ¦   ¦   +-- qualities-page.component.spec.ts
¦   ¦   ¦   ¦   +-- qualities-page.component.ts
¦   ¦   ¦   +-- review-page
¦   ¦   ¦       +-- review-page.component.html
¦   ¦   ¦       +-- review-page.component.scss
¦   ¦   ¦       +-- review-page.component.spec.ts
¦   ¦   ¦       +-- review-page.component.ts
¦   ¦   +-- pipes
¦   ¦       +-- replace-string.pipe.ts
¦   +-- assets
¦   ¦   +-- json
¦   ¦       +-- engagement-id.json
¦   +-- browserslist
¦   +-- config
¦   ¦   +-- config.ts
¦   +-- environments
¦   ¦   +-- environment.development.ts
¦   ¦   +-- environment.prod.ts
¦   ¦   +-- environment.ts
¦   +-- favicon.ico
¦   +-- index.html
¦   +-- karma.conf.js
¦   +-- main.ts
¦   +-- polyfills.ts
¦   +-- styles.scss
¦   +-- test.ts
¦   +-- tsconfig.app.json
¦   +-- tsconfig.spec.json
¦   +-- tslint.json
+-- tsconfig.json
+-- tslint.json
+-- yarn-error.log
+-- yarn.lock
+-- .yarnrc

The contents of my .yarnrc file is as below

--modules-folder "~/.node_modules"
--registry "http://nexus.sample.co/repository/npm-group/"

when I execute following command, I expect that the node modules should be placed in the directory ~/.node_modules in the Linux Operating system (Using Centos 7) where ~ represents the home directory of operating system.

However, I can find that the installation happens in client/~/.node_modules

Please help me understand if it is a bug or I need to fix it at my end.

I also tried using the following configuration in .yarnrc file

--modules-folder "$HOME/.node_modules"
--registry "http://nexus.sample.co/repository/npm-group/"
rally25rs commented 6 years ago

possibly related to #5513

seems like it should have been fixed with #3393

paxperscientiam commented 5 years ago

Hello @sibh8 , please check if $HOME/.yarnrc contains the --modules-folder directive. If so, it seems to be overriding project directive. Not sure why, but appears to be bug.

samuela commented 5 years ago

just came across this exact same issue. def presents a problem for me