【问题标题】:How do I start yarn without getting the following error?如何在不出现以下错误的情况下启动纱线?
【发布时间】:2021-12-28 13:41:34
【问题描述】:

安装所需的依赖项后,我尝试通过在终端中键入 yarn run start 来启动开发服务器,我得到以下输出:

yarn run v1.22.17

Error: EISDIR: illegal operation on a directory, read
   
 at Object.readSync (node:fs:723:3)
    
at tryReadSync (node:fs:433:20)
   
 at Object.readFileSync (node:fs:479:19)
    
at onUnexpectedError (/usr/local/Cellar/yarn/1.22.17/libexec/lib/cli.js:92686:106)
   
 at /usr/local/Cellar/yarn/1.22.17/libexec/lib/cli.js:92805:9

我可以做些什么来解决这个问题?

【问题讨论】:

    标签: node.js terminal yarnpkg yarn-v2


    【解决方案1】:

    我可以通过拥有一个名为 package.json 的目录来重现这一点。

    /v/f/n/8/T/tmp.CgVFBaEa $ mkdir package.json
    /v/f/n/8/T/tmp.CgVFBaEa $ yarn
    yarn install v1.22.11
    Error: EISDIR: illegal operation on a directory, read
        at Object.readSync (node:fs:720:3)
        at tryReadSync (node:fs:430:20)
        at Object.readFileSync (node:fs:476:19)
        at onUnexpectedError (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:92566:106)
        at /usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:92685:9
    

    确保您没有名为package.json(或yarn.lock,我猜)的目录。

    【讨论】:

    • 感谢您的帮助!当我删除它时,我收到以下错误error Couldn't find a package.json file in "/Users/ghofranezirouh" info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.。我是不是做错了什么?
    • 你真的不应该在你的用户文件夹中开始一个项目......
    猜你喜欢
    • 2023-04-04
    • 2022-10-31
    • 2012-07-25
    • 2016-04-15
    • 1970-01-01
    • 2012-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多