简体   繁体   English

纱线“错误:EISDIR:对目录的非法操作,读取”

[英]yarn "Error: EISDIR: illegal operation on a directory, read"

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 Npm 工作正常,但 yarn 只能运行 yarn -v,任何其他命令(例如 yarn、yarn test 或 yarn watch)都会显示此错误

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

EISDIR stands for "Error, Is Directory". EISDIR 代表“错误,是目录”。 This means that yarn is trying to do something to a file but it is a directory.这意味着 yarn 正在尝试对文件执行某些操作,但它是一个目录。 In your case, yarn is trying to "read" a file which is a directory (Line: 4).在您的情况下,yarn 试图“读取”作为目录的文件(第 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). (如果 yarn 依赖于文件中的任何特定信息,您将需要在那里拥有该信息)。

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) (小心:您正在为该文件上的每个人授予读取、写入和执行权限)

It seems yarn is looking for a .npmrc file.似乎纱线正在寻找一个.npmrc文件。 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.这就是.npmrc删除背后的概念。

In my case, after deleting yarn.lock file, I could install dependencies normally就我而言,删除yarn.lock文件后,我可以正常安装依赖项

Try to find and remove.npmrc, which is located in尝试查找并删除.npmrc,它位于

Windows: C:/users/<your username>/.npmrc Windows: C:/users/<your username>/.npmrc

Ubuntu: /home/<your username>/.npmrc Ubuntu: /home/<your username>/.npmrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 fs 错误:EISDIR:对目录的非法操作,读取 - fs Error: EISDIR: illegal operation on a directory, read EISDIR - EISDIR:对目录的非法操作,读取 - EISDIR - EISDIR: illegal operation on a directory, read Bower安装:错误:EISDIR:对目录的非法操作,读取 - Bower install: Error: EISDIR: illegal operation on a directory, read Discord.js 错误:EISDIR:对目录的非法操作,请阅读 - Discord.js Error: EISDIR: illegal operation on a directory, read npm 命令 - 错误:EISDIR:对目录的非法操作,请阅读 - npm command - Error: EISDIR: illegal operation on a directory, read NPM 坚持给出相同的错误 EISDIR:目录上的非法操作,错误读取(本机) - NPM stuck giving the same error EISDIR: Illegal operation on a directory, read at error (native) 节点:使用 fs.readFile 获取错误:EISDIR:对目录进行非法操作,读取 - Node: Using fs.readFile getting Error: EISDIR: illegal operation on a directory, read EISDIR:对目录进行非法操作,读取+ Nodemailer映像附件 - EISDIR: illegal operation on a directory, read + Nodemailer image attachment webpack模块节点产生错误EISDIR:对目录的非法操作 - webpack module node produces error EISDIR: illegal operation on a directory Firebase 云功能:错误:EISDIR:对目录的非法操作 - Firebase cloud function: Error: EISDIR: illegal operation on a directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM