yarn add fails

Created on 26 Nov 2016  路  11Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
bug
What is the current behavior?
yarn add --dev some_package fails because it somehow deletes @types directory in node_modules.
If the current behavior is a bug, please provide the steps to reproduce.

  • yarn init
  • yarn add --dev protractor
  • check node_modules/@types/jasmineexists
  • yarn add --dev karma-sourcemap-loader
  • add fails because
error An unexpected error occurred: "ENOENT: no such file or directory, open 'C:\\Dev\\Projekte\\yarn_add\\node_modules\\@types\\jasmine\\index.d.ts'".
  • check node_modules/@types does not exists

What is the expected behavior?
yarn add --dev karma-sourcemap-loader should not delete folders in node_modules and add it to devDependencies

Please mention your node.js, yarn and operating system version.
node 6.9.1
yarn 0.17.8
windows 10

cat-bug os-windows

All 11 comments

Cannot reproduce.

node: 6.2.1 and 6.9.1
yarn 0.17.8 and 0.17.9
os: ubuntu 16.04

I have tried it on both macOS & ubuntu and it's working. Need someone to test it on Windows.

This drives me pretty batty. On small projects you can usually run add again and it fixes it, but on larger projects there is usually more than one module playing up and it alternates between missing files in each of them, so you can never get anything done.

位 ver
Microsoft Windows [Version 10.0.14971]

位 node -v
v6.9.1

位 yarn init
yarn init v0.17.9
question name (test):
question version (1.0.0):
question description:
question entry point (index.js):
question git repository:
question author:
question license (MIT):
success Saved package.json
Done in 11.02s.

位 yarn add --dev protractor
yarn add v0.17.9
info No lockfile found.
[1/4] Resolving packages...
warning protractor > jasmine > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 117 new dependencies.
鈹溾攢 @types/[email protected]
鈹溾攢 @types/[email protected]
鈹溾攢 @types/[email protected]
鈹溾攢 @types/[email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹斺攢 [email protected]
Done in 7.26s.

位 ls node_modules\@types\jasmine\
README.md  index.d.ts  package.json  types-metadata.json

位 yarn add --dev karma-sourcemap-loader
yarn add v0.17.9
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred: "ENOENT: no such file or directory, open 'C:\\c\\test\\node_modules\\@types\\jasmine\\index.d.ts'".
info If you think this is a bug, please open a bug report with the information provided in "C:\\c\\test\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

位 ls node_modules\@types\jasmine\
ls: cannot access node_modules\@types\jasmine\: No such file or directory

位 yarn add --dev karma-sourcemap-loader
yarn add v0.17.9
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
鈹溾攢 [email protected]
鈹斺攢 [email protected]
Done in 5.82s.

位 ls node_modules\@types\jasmine\
README.md  index.d.ts  package.json  types-metadata.json

And the yarn-error.log.

@torifat
I have tried version 0.17.9 and it's working on windows 10.

node: 7.2.0
yarn 0.17.9
windows 10

Might be as well fixed by #1861 but is not yet released. Should be tested on master branch.

@onemen / @torifat: Not working using node 7.2.0 for me.

After more testing:
with 0.17.9 - after yarn add --dev protractor @types folder contained 4 sub folders jasmine, node, q, selenium-webdriver with 4 files each index.d.ts, package.json, README.md, types-metadata.json
after installing karma yarn add --dev karma-sourcemap-loader the @types folder and its sub folder removed!
No error was reported.

with master (ac90c23be2766229e46b177f9f7f80916ee3e663) everything work as expected

Can confirm, this appears to be fixed in v0.18.0.

Going to close with reports of this being resolved with v0.18.0. @maffelbaffel, please let us know if it is still an issue after you upgrade.

@wyze works as expected. Thanks alot :)

Was this page helpful?
0 / 5 - 0 ratings