Do you want to request a _feature_ or report a _bug_?
bug
What is the current behavior?
ENOENT
$ yarn
/usr/lib64/node_modules/yarn/bin/yarn.js:48
throw err;
^
Error: ENOENT: no such file or directory, open '/usr/lib64/node_modules/yarn/node_modules/chalk/node_modules/escape-string-regexp/index.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Object.Module._extensions..js (module.js:564:20)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib64/node_modules/yarn/node_modules/chalk/index.js:2:26)
If the current behavior is a bug, please provide the steps to reproduce.
sudo npm i -g yarn
yarn
What is the expected behavior?
no ENOENT
Please mention your node.js, yarn and operating system version.
Node v6.7.0
Yarn 0.15.1
Gentoo Stable
Hi! What installation method did you use to install Yarn on Gentoo?
I tried portage and npm global install, same error.
sudo yarn is working normally
I get a similar error with [email protected] extracted with tarball locally to my project.
Error: ENOENT: no such file or directory, open 'C:\path\to\project\node_modules\escape-string-regexp\index.js'
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.Module._extensions..js (module.js:404:20)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\path\to\project\tools\yarn-v0.16.0\dist\node_modules\chalk\index.js:2:26)
at Module._compile (module.js:398:26)
This is when I use my locally installed [email protected]. It doesn't occur when I switch to my globally installed [email protected]. The thing here is that it fails immediately by not finding C:\path\to\project\node_modules\escape-string-regexp\index.js when it should be looking for C:\path\to\project\tools\yarn-v0.16.0\dist\node_modules\escape-string-regexp\index.js?
I'm having the same problem using NodeJS 6.9.1 on Gentoo Linux. I can only run yarn as root but not as unprivileged user.
# whoami
root
# node -v
v6.9.1
# npm -v
3.10.8
# npm i -g yarn
/usr/bin/yarn -> /usr/lib/node_modules/yarn/bin/yarn.js
/usr/bin/yarnpkg -> /usr/lib/node_modules/yarn/bin/yarn.js
/usr/lib
└─┬ [email protected]
[...]
# yarn --version
0.16.1
# logout
$ whoami
steffen
$ yarn --version
/usr/lib64/node_modules/yarn/bin/yarn.js:47
throw err;
^
Error: ENOENT: no such file or directory, open '/usr/lib64/node_modules/yarn/node_modules/chalk/node_modules/escape-string-regexp/index.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Object.Module._extensions..js (module.js:578:20)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib64/node_modules/yarn/node_modules/chalk/index.js:2:26)
My case: Node 6.9.1, Yarn 0.16.1, Linux Mint.
Deleting totally and reinstalling with --production did not work.
I had the same issue. It seems npm -g install wasn't transitively installing all the dependencies yarn needed.
I manually deleted ~/.nvm/versions/node/v4.6.1/lib/node_modules/yarn, then re-installed with npm install -g --production yarn and things worked.
Windows 10, Node v7.1.0, npm 3.10.9. Yarn 0.17.2.
Doesn't work either.
Ubuntu 14.10, Node v.7.2.0, npm 3.10.9, Yarn 0.17.10.
sudo yarn works but yarn doesn't.
update: I manually remove all yarn-related files under /home/${user}/**,
ex: .yarn, .config/yarn, ./cache/yarn, reinstall node.js and yarn then everything seems to work now.
I'm having this issue as well. Win10, node 7.2.0, yarn 0.17.10
As a reproduction:
yarn as a dependency.execSync as /home/travis/build/ember-cli/ember-cli/node_modules/yarn/bin/yarn.js link with cwd set to /home/travis/build/ember-cli/ember-cli.Outputs an error:
Error: ENOENT: no such file or directory, open '/home/travis/build/ember-cli/ember-cli/node_modules/yarn/node_modules/camelcase/index.js'
That is a correct statement: the file doesn't exist there. However, that ENOENT is triggered by a require, and it should continue with the module resolution algorithm.
Because Ember CLI has another dependency which includes camelcase it ends up hoisted up a level and can be found at '/home/travis/build/ember-cli/ember-cli/node_modules/camelcase/index.js. Node should be able to find this, but it is hard-failing for some reason after the first lookup attempt–because it believes that it found it.
I'm wondering if this is in some way correlated to roadrunner? Something that should be remarkably stable by now shouldn't be blowing up.
Full PR for context: https://github.com/ember-cli/ember-cli/pull/6461
Error message on CI: https://travis-ci.org/ember-cli/ember-cli/jobs/182539101#L1999-L2039
You can reproduce locally by checking this out, running yarn install and yarn run test-slow.
Getting the same kind of error:
yarn install failed with exit code 1: fs.js:583
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open '/Users/felix/go/src/sourcegraph.com/sourcegraph/sourcegraph/xlang/javascript-typescript/buildserver/node_modules/end-of-str
eam/node_modules/once/once.js'
at Object.fs.openSync (fs.js:583:18)
at Object.fs.readFileSync (fs.js:490:33)
at Object.Module._extensions..js (module.js:579:20)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (/Users/felix/go/src/sourcegraph.com/sourcegraph/sourcegraph/xlang/javascript-typescript/buildserver/node_modules/v8-compile-cache/v8-compile-cache.js:159:2
0)
at Object.<anonymous> (/Users/felix/go/src/sourcegraph.com/sourcegraph/sourcegraph/xlang/javascript-typescript/buildserver/node_modules/end-of-stream/index.js:1:74)
at Module._compile (/Users/felix/go/src/sourcegraph.com/sourcegraph/sourcegraph/xlang/javascript-typescript/buildserver/node_modules/v8-compile-cache/v8-compile-cache.
js:178:30)
yarn is installed locally (not globally).
I installed latest node (7.8.0) and install yarn again. It works now. But, what is the real cause of problem and solution?
I'm having this issue after I installed yarn through npm (npm install -g yarn) on Windows 10. It worked well when I used the last version (0.21.3).
Just heard yesterday, that installing Yarn via NPM is not recommended https://yarnpkg.com/lang/en/docs/install/#alternatives-tab
I know this is old but I had that problem with /Users/username/.config directory and I don't know where to post this since there is an related issue in npm here for that. I hope this helps:
I installed crosstool-ng, which creates a .config file... renaming that solved the problem for me...
macOS:10.13.3 npm 5.6.0, yarn 1.5.1, node 9.8.0
Just for reference, I got exactly the same error message when I run it on build server (Windows - TFS) and the working folder didn't exist.
Most helpful comment
I'm having the same problem using NodeJS 6.9.1 on Gentoo Linux. I can only run yarn as root but not as unprivileged user.