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.72k forks source link

Running yarn to install my packages - some files not being pulled into the package directory #3169

Open m-andrew-albright opened 7 years ago

m-andrew-albright commented 7 years ago

Do you want to request a feature or report a bug?

Bug

What is the current behavior? The datatables.net-dt package is installed in my node_modules package directory, missing several files.

If the current behavior is a bug, please provide the steps to reproduce.

On my machine, every time I run yarn or yarn add datatables.net-dt the package is installed without several necessary files.

What is the expected behavior? The package would be installed with all the files it contains in NPM's registry.

Please mention your node.js, yarn and operating system version. Node: 7.5.0 Yarn: 0.22.0 Windows: 10: image

--

I checked the cache on my machine, and all the files are there, but in my node_modules, several files are missing. The expected files in my cache: image

The actual directory contents in ./node_modules/datatables.net-dt: image

This causes me to have to copy the files over every time yarn runs.

I will be glad to supply any additional logs / details that might be helpful in this issue.

edit updated version

ninjasort commented 7 years ago

+1 I get the same behavior. It's unexpected.

jmandzik commented 7 years ago

We've had two people on my team have this exact issue (macOS). The files are present in the cache, but yarn (0.21, 0.22, & 0.23) only brings some of the files to the corresponding node_modules folder. Interestingly, it was even the same package and missing files for the two engineers.

I cannot reproduce locally, but we're working around it locally with manual npm install of the 1/2 installed package.

timthomp commented 7 years ago

False alarm for my part. The problem was that my yarn cache was incomplete for some reason. I cleared my cache and it worked fine.

+1 also getting this behavior with an local eslint plugin we install install from the file system. Also Windows 10 professional. "devDependencies": { ... "eslint-plugin-xmatters": "file:../eslint-plugin-xmatters", ...

m-andrew-albright commented 7 years ago

This is still prevalent for me and very annoying. We are about to switch back to npm because of this issue. If anyone knows a workaround, please let me know. Manually npm i datatables.net-dt every time I yarn is not fun.

m-andrew-albright commented 7 years ago

Still happening for me in 0.24.6

I determined that it is copying all the files over properly, but then during step [5/5] Cleaning modules... some of the files are removed.

matthiasg commented 7 years ago

Same is happening with just running yarn install vue .. the resulting node_modules/vue folder is missing all script files in node_modules/vue/dist. Only the README is downloaded.

This reminds me of an error in a decompression library I once used

PS: node 8, yarn 0.24.6, win10

niccofyren commented 7 years ago

Im pretty sure this issue is caused by the yarn module cleanup step as @m-andrew-albright mentioned.

To fix:

  1. Check your project directory for a file named: .yarnclean
  2. Delete the file, or uncomment any suspect entries
  3. Try a clean yarn install, yarn install --force, or similar

The source of the .yarnclean file in questions seems to be running the yarn clean command. The file includes a list of file/directory patterns that gets cleaned after every yarn install as long as the file is present.

Related discussion about renaming the clean command to something that better reflects what it actually does: #2438

imsurinder90 commented 7 years ago

The above solution worked for me!! 👍 I commented .yarnclean file and then re-run yarn add package-name (run only for package of which images directory missing)

matthiasg commented 7 years ago

At least with vue .yarnclean is not the issue. I don't have any and vue does not either.

iamakulov commented 6 years ago

Cleaning the cache (with yarn cache clean <package-name>) helped me here.

ChrisEdgington commented 6 years ago

I had this issue with semantic-ui-css, removing the .yarnclean file solved it for me.

ThisNameNotUsed commented 4 years ago

overdoingit #toomanyoptions #don'tbemorethanyouare.

.yarnclearn is cool and all but it SHOULD NOT have so many file names/types in it by default.

I had to start using yarn because a package I was using strongly suggested it and wouldn't work without it. I had too much on my plate to find out why or study yarn. This stupid default .yarnclean bug gave me headaches for 9 FREAKING MONTHS before I finally came back with a calmer mind and more experience to figure out that it was even coming from yarn. My main package was missing images and I MANUALLY DOWNLOADED THEM AND STUCK THEM IN THERE! CAN YOU IMAGINE!????????

I suggest keeping the .yarnclean file in there by default but commenting out the whole thing then adding two comment-sentences at the top of the file explaining why the .yarnclean file is there and how to use it. i.e. "Uncomment this file and yarn [whatever commnad] to filter out these common files which are commonly included in packages by accident. This is a special and useful feature brought to you by yarn and [yadda yadda yadda]." or " A .yarnclean file is like a git .ignore file for your package manager. We've given you a list of common files that are often accidentally included in packages and unnecessarily bloat your project. Try this feature out by uncommenting this file."

I probably won't be able to convince my team not to rebuild the project form the starter-project-tutorials on up just so they don't have to use yarn because this little bug has made them lose faith in it.