Reputation: 1351
Suddenly yarn is not working. Npm works perfectly but yarn only is able to run yarn -v, any other command such as yarn, yarn test, or yarn watch shows this error
Arguments:
/home/my.user/.nvm/versions/node/v14.15.4/bin/node /home/my.user/.nvm/versions/node/v14.15.4/bin/yarn
PATH:
/home/my.user/.nvm/versions/node/v14.15.4/bin:/home/my.user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Yarn version:
1.22.10
Node version:
14.15.4
Platform:
linux x64
Trace:
Error: EISDIR: illegal operation on a directory, read
npm manifest:
{
"name": "one",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo 'hello'"
},
"keywords": [],
"author": "",
"license": "ISC"
}
yarn manifest:
No manifest
Lockfile:
No lockfile
Upvotes: 5
Views: 29748
Reputation: 10956
In my case, after deleting yarn.lock
file, I could install dependencies normally
Upvotes: 14
Reputation: 71
It seems yarn is looking for a .npmrc file. It however finds a directory with the same name, then puts out the error when it tries to read it. Removing the directory will remove the error. That is the concept behind the .npmrc removal.
Upvotes: 7
Reputation: 77
Try to find and remove .npmrc, which is located in
Windows:
C:/users/<your username>/.npmrc
Ubuntu:
/home/<your username>/.npmrc
Upvotes: 4
Reputation: 7073
EISDIR stands for "Error, Is Directory". This means that yarn is trying to do something to a file but it is a directory. In your case, yarn is trying to "read" a file which is a directory (Line: 4). Since the operation cannot be done the error is thrown.
Three things to make sure of here.
Make sure the file exists. If it does not, you need to create it. (If yarn depends on any specific information in the file, you will need to have that information there).
Make sure it is in fact a file and not a directory. It has the right permissions. You can change the file to have all permissions with
sudo chmod 777 FILE_NAME
(Careful: You are giving Read, Write and Execute permissions to every one on that file)
Upvotes: 4