Failure of yarn upgrade - yarnpkg

When I want to upgrade a dependency of my project (lodash package), I run the following command:
yarn upgrade lodash
I face with the following error:
yarn upgrade v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/path-postId/-/path-postId-2.0.1.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "Unexpected end of data"
I consulted the mentioned page but I couldn't find any useful information to resolve the issue.

The following steps resolved the problem:
Remove the yarn.lock file.
rm yarn.lock
Recreate the yarn.lock file by running the following command:
yarn install
Upgrade the dependency using --skip-integrity-check:
yarn upgrade --skip-integrity-check lodash

Related

Why is my React Native Pod Install Erroring?

Trying to run pod install in a new React Native project and getting this error. Ruby is installed with brew
I have installed chruby and ruby-install, which I have then used to install ruby-2.7.5 cocopods, ffi and bundler. When trying bundler to install I get this error:
warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
fatal: not a git repository (or any of the parent directories): .git
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes/hermes-engine.podspec`
[!] Couldn't determine repo type for URL: `https://cdn.cocoapods.org/`: Permission bits for '/Users/macbook/.netrc' should be 0600, but are 644
So I put out a bounty on this because I couldn't figure it out for ages. Until I did. (Hopefully this fix works for everyone else)
First when I ran xcode-select -p it was returning /Library/Developer/CommandLineTools
However this looked odd as another an answer here seemed to suggest that maybe this was causing an issue. It ended up that I just hadn't set my CLI tools correctly as described in the react native docs. Since it only had one option in the dropdown I assumed that the CLI tools were already set. However when I went back and specifically clicked on the one option, it made changes to my system.
Now running xcode-select -p returns /Application/Xcode.app/Contents/Developer
TL;DR : Open Xcode, go to 'Settings...' in the menu bar. Then go to the 'Locations' tab and click on the 'Command Line Tools' dropdown and click on the latest version (click on a version even if it seems like a version is already set). Now try your pod install again!
Probably this answer(https://stackoverflow.com/a/69427481/8988448) would solve your issue. Looks like you haven't given proper permissions.
run chmod 600 ~/.netrc and once it is done, run pod install.
Got same error as below:
✔ Downloading template
✔ Copying template
✔ Processing template
ℹ Installing dependencies
✔ CocoaPods (https://cocoapods.org/) is not installed. CocoaPods is necessary for the iOS project to run correctly. Do you want to install it? › Yes, with gem (may require sudo)
✔ Installing CocoaPods
✔ Installing Bundler
✖ Installing CocoaPods dependencies (this may take a few minutes)
error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Environment: macOS Catalina 10.15.7
Through gem installed cocoapods like below.
rn sudo gem install -n /usr/local/bin cocoapods
Password:
When run react-native init myproj, choose gem to install coacopods again.
Hello once I also had same issue . I have resolve it.Follow this step it would work .
This error is cause by installing same package multiple time in single project
Try to remove that package from project and reinstall that project.
Try to uninstall ruby-2.7.5
yarn remove package name
yarn add package name
or
npm uninstall package name
npm install package name
and
cd ios && pod install && cd ..
npx react-native run-ios

Yarn throw the error on installation alwasy throws an TypeError

without this error, my angular cli never installed. do not know the real issue. here is the error:
PS E:\Training\NxWorkshop\angular-cli> yarn install --network-timeout=500000
yarn install v1.22.17
info No lockfile found.
[1/4] Resolving packages...
warning #angular-devkit/build-angular > stylus > css > source-map-resolve#0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
[2/4] Fetching packages...
[#------------------------------------------------------------------------------------------------------------------------------------------------------------------] 6/851node:_tls_wrap:411
owner._tlsOptions.isServer ? 'server' : 'client', err,
^
TypeError: Cannot read properties of undefined (reading 'isServer')
at TLSWrap.onerror (node:_tls_wrap:411:27)
PS E:\Training\NxWorkshop\angular-cli>
how to solve it? what should i do?
thanks in advance

Composer always fails to install symfony/var-dumper

I'm trying to install the latest version of Laravel 8 on the latest version of Homestead. When I run composer install or composer update, installation of symfony/var-dumper always fails:
Installing symfony/var-dumper (v5.2.6): Extracting archive
Install of symfony/var-dumper failed
[ErrorException]
file_get_contents(/home/vagrant/code/vendor/symfony/var-dumper/Resources/bin/var-dump-server):
Failed to open stream: No such file or directory
Despite the error exception, the file /vendor/symfony/var-dumper/Resources/bin/var-dump-server does exist.
Things I've tried:
Deleting the lock file and re-running composer update
Manually specifying specific versions of var-dumper, e.g. composer require symfony/var-dumper:5.2.0
I always get the same errors.
Remove /vendor folder, then run:
composer update -v
This turned out to be a compatibility issue with Composer 2.x. I downgraded to the 1.x channel using composer self-update --1, then ran composer install again, and the installation succeeded.
Composer version 2.2.4 2022-01-08 12:30:42
and
symfony/var-dumper v5.4.3
is working just fine

Incorrect integrity when fetching from the cache

When running yarn add --dev jest, I got error Incorrect integrity when fetching from the cache.
Full output:
tests (master)$ yarn add --dev jest
yarn add v1.19.0
info No lockfile found.
[1/4] Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad#1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
error Incorrect integrity when fetching from the cache
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
I tried removed node_modules, re-ran yarn install and yarn add --dev jest to no avail.
How do I fix this?
yarn cache clean
To fix this, run:
yarn cache clean
yarn add --dev jest
From the yarn cache documentation:
yarn cache clean [<module_name...>]
Running this command will clear the global cache. It will be populated again the next time yarn or yarn install is run. Additionally, you can specify one or more packages that you want to clean.
You can also see where the cache is with yarn cache dir.
yarn cache dir
Running yarn cache dir will print out the path where yarn’s global cache is currently stored.
Yarn cache clean did not help. We must downgrading yarn version on the server.
It turns out that the problem is associated with the use of private packages.
GitHub Yarnpkg - "Incorrect integrity when fetching from the cache" #7584
For anyone who is working with heroku and sees this error:
install heroku cli
login via heroku login
heroku plugins:install heroku-repo
heroku repo:purge_cache -a $YOURAPPNAME
then do a manual rebuild
Clean the cache and reinstall:
yarn cache clean
yarn install -f
You need to run these two commands before installing the package:
yarn config set unsafe-disable-integrity-migration false
yarn cache clean
Tried to upgrade yarn and it solved my problem. It may be due to the compatibility issue
yarn policies set-version
Will download the latest stable release
Reference : yarn docs https://yarnpkg.com/lang/en/docs/cli/policies/#toc-policies-set-version

"Missing list of packages to add to your project" error while install Heroku deploy plugin

I want deploy my JHipster application to Heroku, but when I run command "jhipster heroku", I received the following error:
Installing Heroku CLI deployment plugin
× { Error: Command failed: heroku plugins:install heroku-cli-deploy --force
Installing plugin java... yarn add v1.12.3
Installing plugin java... [1/4] Resolving packages...Installing plugin java... [2/4] Fetching packages...Installing plugin java... [3/4] Linking dependencies...Installing plugin java... [4/4] Building fresh packages...Installing plugin java... success Saved 1 n
ew dependency.Installing plugin java... info Direct dependenciesInstalling plugin java... └─ #heroku-cli/plugin-java#3.0.1Installing plugin java... Done in 2.97s.Installing plugin java... installed v3.0.1
Installing plugin --force... yarn add v1.12.3
Installing plugin --force... info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.Installing plugin --force... !
error Missing list of packages to add to your project.
Error: yarn add --force#latest --non-interactive --mutex=file:C:/Users/start/AppData/Local/heroku/yarn.lock --preferred-cache-folder=C:/Users/start/AppData/Local/heroku/yarn --check-files --registry=https://registry.npmjs.org exited with code 1
at ChildProcess.forked.on (C:/Program Files/heroku/client/node_modules/#oclif/plugin-plugins/lib/yarn.js:31:28)
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
killed: false,
code: 1,
signal: null,
cmd: 'heroku plugins:install heroku-cli-deploy --force' }
Versions of tools:
JHipster: 5.1.0
Heroku: heroku/7.19.4 win32-x64 node-v11.3.0
Yarn: 1.7.0
Node: v8.10.0
I've already tried out the following commands:
heroku plugins:install java - successfully installed
heroku plugins:install heroku-cli-deploy --force -
Then an error occurs:
Installing plugin java... installed v3.0.1
error Missing list of packages to add to your project.
Installing plugin --force... !
Error: yarn add --force#latest --non-interactive --mutex=file:C:/Users/start/AppData/Local/heroku/yarn.lock --preferred-cache-folder=C:/Users/start/AppData/Local/heroku/yarn --check-files --registry=https://registry.npmjs.org exited with code 1
at ChildProcess.forked.on (C:/Program Files/heroku/client/node_modules/#oclif/plugin-plugins/lib/yarn.js:31:28)

Resources