简体   繁体   English

由于文件不存在,纱线安装失败

[英]Yarn Install fails due to non existing file

I am deploying a site to netlify.我正在部署一个站点来 netlify。 The site deployed fine until I installed react-player using npm install react-player There were a number of critical errors that I tried to fix.该站点部署良好,直到我使用npm install react-player react-player尝试修复了许多严重错误。

The site builds fine locally using yarn run build and it runs fine locally doing npm start .该站点使用yarn run build在本地构建良好,并且在本地运行良好npm start

But when I deploy it to netlify I get an error with Yarn Install that shows the following但是当我将它部署到 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

I am not sure how to approach solving this error.我不确定如何解决此错误。 I have checked a number of similar posts such as npm install fails, yarn install succeeds on netlify deploy but I am not finding a good solution.我检查了许多类似的帖子,例如npm install failed, yarn install 在 netlify deploy 上成功,但我没有找到好的解决方案。

Thanks for your help谢谢你的帮助

the issue was in the yarn.lock file.问题出在yarn.lock文件中。 It was referring to chokidar2 which was not working.它指的是chokidar2不起作用。

I removed the yarn.lock file and my node modules folder.我删除了yarn.lock文件和我的node modules文件夹。

Then I ran yarn cache clean然后我运行yarn cache clean

then I reran yarn install to reinstall node modules然后我重新运行yarn install以重新安装node modules

Then I ran yarn run build然后我跑了yarn run build

and reuploaded everything to git with the new build并使用新版本将所有内容重新上传到git

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM