【问题标题】:Yarn Install fails due to non existing file由于文件不存在,纱线安装失败
【发布时间】:2022-01-23 19:23:56
【问题描述】:

我正在为 netlify 部署一个站点。 该站点部署良好,直到我使用 npm install react-player 安装 react-player 我尝试修复了许多严重错误。

该站点使用yarn run build 在本地构建良好,并且在本地使用npm start 运行良好。

但是当我将它部署到 netlify 时,我收到 Yarn Install 的错误,显示以下内容

5:21:48 AM: Build ready to start
5:21:50 AM: build-image version: 73def8bb10593b9b818f44989a75ea508018ccb7 (focal)
5:21:50 AM: build-image tag: v4.5.2
5:21:50 AM: buildbot version: 8cd320132979d1a1a502e85e77b47b97cc7d659f
5:21:50 AM: Fetching cached dependencies
5:21:50 AM: Starting to download cache of 237.2MB
5:21:52 AM: Finished downloading cache in 2.467525285s
5:21:52 AM: Starting to extract cache
5:22:00 AM: Finished extracting cache in 7.81313843s
5:22:00 AM: Finished fetching cache in 10.326357005s
5:22:00 AM: Starting to prepare the repo for build
5:22:01 AM: Preparing Git Reference refs/heads/main
5:22:02 AM: Parsing package.json dependencies
5:22:03 AM: Starting build script
5:22:03 AM: Installing dependencies
5:22:03 AM: Python version set to 2.7
5:22:03 AM: Started restoring cached node version
5:22:05 AM: Finished restoring cached node version
5:22:05 AM: v16.13.2 is already installed.
5:22:06 AM: Now using node v16.13.2 (npm v8.1.2)
5:22:06 AM: Started restoring cached build plugins
5:22:06 AM: Finished restoring cached build plugins
5:22:06 AM: Attempting ruby version 2.7.2, read from environment
5:22:07 AM: Using ruby version 2.7.2
5:22:07 AM: Using PHP version 8.0
5:22:07 AM: Started restoring cached yarn cache
5:22:12 AM: Finished restoring cached yarn cache
5:22:13 AM: No yarn workspaces detected
5:22:13 AM: Started restoring cached node modules
5:22:13 AM: Finished restoring cached node modules
5:22:13 AM: Installing NPM modules using Yarn version 1.22.10
5:22:14 AM: yarn install v1.22.10
5:22:14 AM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
5:22:14 AM: [1/4] Resolving packages...
5:22:15 AM: warning react-scripts > fsevents@2.1.2: "Please update to latest v2.3 or v2.2"
5:22:15 AM: warning react-scripts > webpack-dev-server > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:22:15 AM: warning react-scripts > babel-jest > @jest/transform > jest-haste-map > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:22:15 AM: error Package "chokidar2" refers to a non-existing file '"/opt/build/repo/chokidar2"'.
5:22:15 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
5:22:15 AM: Error during Yarn install
5:22:15 AM: Build was terminated: Build script returned non-zero exit code: 1
5:22:15 AM: Creating deploy upload records
5:22:15 AM: Failing build: Failed to build site
5:22:15 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
5:22:15 AM: Finished processing build request in 25.380006101s

我不确定如何解决此错误。我检查了许多类似的帖子,例如npm install fails, yarn install succeeds on netlify deploy,但我没有找到好的解决方案。

感谢您的帮助

【问题讨论】:

    标签: reactjs npm deployment yarnpkg netlify


    【解决方案1】:

    问题出在yarn.lock 文件中。它指的是chokidar2,它不起作用。

    我删除了yarn.lock 文件和我的node modules 文件夹。

    然后我跑了yarn cache clean

    然后我重新运行yarn install 以重新安装node modules

    然后我跑了yarn run build

    并使用新版本将所有内容重新上传到git

    【讨论】:

      猜你喜欢
      • 2022-06-14
      • 1970-01-01
      • 1970-01-01
      • 2022-08-18
      • 2021-10-22
      • 1970-01-01
      • 2021-02-17
      • 2020-05-06
      • 2022-01-15
      相关资源
      最近更新 更多