Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Weird problem with installation #656

Closed
MRokas opened this issue Oct 11, 2016 · 9 comments
Closed

Weird problem with installation #656

MRokas opened this issue Oct 11, 2016 · 9 comments

Comments

@MRokas
Copy link

MRokas commented Oct 11, 2016

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

What is the current behavior?

rokas@ROKAS ~/dev/verse
$ yarn add @types/react -dev
yarn add v0.15.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
└─ @types/react@0.14.39
Done in 0.89s.

# at this point node_modules has @types/react

rokas@ROKAS ~/dev/verse
$ yarn add @types/react-dom -dev
yarn add v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\Users\rokas\dev\verse\node_modules\@types\react-dom\index.d.ts'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.

# at this point node_modules is empty

$ yarn add @types/react-dom @types/react -dev
yarn add v0.15.1
warning No license field
[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.
├─ @types/react-dom@0.14.17
└─ @types/react@0.14.39
Done in 2.25s.

# at this point it has both of them

rokas@MAZIAI ~/dev/verse
$ yarn add react react-dom
yarn add v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\Users\rokas\dev\verse\node_modules\@types\react\index.d.ts'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.

# at this point @types is gone, it has react/react-dom and their dependencies, however none has package.json

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

yarn add @types/react @types/react-dom -dev
yarn add react react-dom

What is the expected behavior?
It shouldn't clear

Please mention your node.js, yarn and operating system version.
node@6.3.1
yarn@0.15.1
Windows7 64bit

@Daniel15
Copy link
Member

Seems like there's something specific to Windows happening here, I can only repro on Windows but not Linux.

On Windows:

C:\temp\yarntest
λ c:\src\yarn\bin\yarn add @types/react @types/react-dom -dev
yarn add v0.15.0
info No lockfile found.
[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.
├─ @types/react-dom@0.14.17
└─ @types/react@0.14.39
Done in 1.14s.

C:\temp\yarntest(<invalid_name>@<invalid_version>)
λ c:\src\yarn\bin\yarn add react react-dom
yarn add v0.15.0
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\temp\yarntest\node_modules\@types\react\index.d.ts'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.

On Debian Linux:

10:41 daniel@dan /tmp/yarntest
% /usr/local/src/yarn/bin/yarn add @types/react @types/react-dom -dev
yarn add v0.15.0
info No lockfile found.
[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.
├─ @types/react-dom@0.14.17
└─ @types/react@0.14.39
Done in 2.90s.

10:42 daniel@dan /tmp/yarntest
% /usr/local/src/yarn/bin/yarn add react react-dom
yarn add v0.15.0
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.
├─ asap@2.0.5
├─ core-js@1.2.7
├─ encoding@0.1.12
├─ fbjs@0.8.5
├─ iconv-lite@0.4.13
├─ immutable@3.8.1
├─ is-stream@1.1.0
├─ isomorphic-fetch@2.2.1
├─ js-tokens@1.0.3
├─ loose-envify@1.2.0
├─ node-fetch@1.6.3
├─ object-assign@4.1.0
├─ promise@7.1.1
├─ react-dom@15.3.2
├─ react@15.3.2
├─ ua-parser-js@0.7.10
└─ whatwg-fetch@1.0.0
Done in 8.67s.

@Lichthagel
Copy link

+1 For me it always works at a second try. But still pls fix.

@flagbug
Copy link

flagbug commented Dec 1, 2016

Same problem here, but it's always a different file under \@types\. Retrying the command also doesn't work, it's still throwing that error.

@eamodio
Copy link
Contributor

eamodio commented Dec 3, 2016

Same here -- while it will very often work the 2nd time, another run after that very often fails.

@jodator
Copy link

jodator commented Apr 11, 2017

I had similar issue with local packages: "package": "file:./../../package/dir" on Linux Mint LMDE. Each run resulted in different missing file.

An unexpected error occurred: "ENOENT: no such file or directory,
 open '/home/user/.cache/yarn/v1/npm-package-dir-0.9.0/src/index.js'".

where package-dir was package-name and package resides under ./../../package/dir.

Update:
yarn@0.22
node@6.10.2

@BYK
Copy link
Member

BYK commented Oct 26, 2017

We need to confirm this with the latest Yarn version.

@mderoche
Copy link

mderoche commented Oct 26, 2017

I still get this issue often, with the Yarn 1.2.1 + macOS 10.13 + Node v6.11.3. I've tried for a long time to come up with steps to reproduce, but it seems to happen completely randomly for me.

I'll do a yarn add jquery, for example. During the linking step, it will sometimes throw an error saying that some dependency of some other dependency (completely unrelated to jquery) doesn't exist.

While it seems to happen randomly, the ansi-styles package is a common "missing file" that I see in my error messages.

[3/4] 🔗  Linking dependencies..
error An unexpected error occurred: "ENOENT: no such file or directory, open '/path/to/app/node_modules/@someScope/some-dep/node_modules/ansi-styles/index.js'".

Running the same exact yarn add command again will often fix it. Sometimes it throws the same ENOENT error, but with a different file... and I just end up running yarn add until it works. Sometimes it works on the first try, sometimes on the second, sometimes on the third, etc...

When it finally does work, the file that it originally errors on (ansi-styles/index.js) still isn't there, but apparently it's no longer an issue for it?

I've seen this issue across multiple projects using completely independent lists of dependencies. Doing the same exact thing on a project will sometimes trigger this, and sometimes not, in seemingly identical environments.

This may be a complete red herring, but it seems to happen more when my internet traffic is higher, and always with a yarn linked package in the error message.

@hazasaad
Copy link

i had this problem..how to solve this mine windows 7 32 bit
C:\xampp\htdocs\project>yarn install
yarn install v1.3.2
[1/4] Resolving packages...
events.js:160
throw er; // Unhandled 'error' event
^

Error: This socket is closed
at WriteStream.Socket._writeGeneric (net.js:679:19)
at WriteStream.Socket._write (net.js:730:8)
at doWrite (_stream_writable.js:331:12)
at writeOrBuffer (_stream_writable.js:317:5)
at WriteStream.Writable.write (_stream_writable.js:243:11)
at WriteStream.Socket.write (net.js:657:40)
at Console.warn (console.js:51:16)
at C:\Program Files\Yarn\lib\cli.js:73181:5
at Array.forEach (native)
at EventEmitter. (C:\Program Files\Yarn\lib\cli.js:73174:24)

C:\xampp\htdocs\project>yarn -v
1.3.2

C:\xampp\htdocs\project>npm -v
3.10.10

@olingern
Copy link
Contributor

Going to close this unless someone can confirm it's still an issue. If so, will reopen

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests