yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.45k stars 2.73k forks source link

Tarball is not in network and can not be located in cache #7598

Open v0lume opened 5 years ago

v0lume commented 5 years ago

Do you want to request a feature or report a bug? bug

What is the current behavior? all cache is cleared. yarn.lock and node_modules was removed. when trying to install packages using yarn - facing error

nb-180-73b:survey artsiom$ yarn
yarn install v1.19.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
error "proxy-agent-3.1.0.tgz": Tarball is not in network and can not be located in cache (["---survey/proxy-agent-3.1.0.tgz","/Users/---/Library/Caches/Yarn/v5/.tmp/1cb65d53db120924735197f89834781e/.yarn-tarball.tgz"])
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce. just type yarn in your console

What is the expected behavior? installation without any errors

Please mention your node.js, yarn and operating system version. macos 10.14.6 yarn 1.19.0, 1.17.0 node 10.16.0

LucaPrete commented 5 years ago

Same here. This happens both with node 8.11.3 and node 10.14.1

francescopersico commented 5 years ago

On my project it was caused by the snyk package. If it is the case pin/update it.

v0lume commented 5 years ago

I'm very confused cause just now I ran yarn on the same project - and everything was installed without any errors

TuxGit commented 4 years ago

Install my tarball on win7 successfully, but ...

The same error on

ghasemikasra39 commented 4 years ago

same happens to me:

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 21.29 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
    Yarn: 1.22.4 - ~/Documents/youpendo-app-bareworkflow/node_modules/.bin/yarn
    npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.1, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 12.1/12A7403 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_232 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: ^4.8.0 => 4.13.0
    react: 16.13.1 => 16.13.1
    react-native: 0.63.3 => 0.63.3
    react-native-macos: Not Found
joshtune commented 4 years ago

Same issue here

tinybigideas commented 3 years ago

To get around this issue I manually created the local cache and copied the tarball in to where it wanted it. Finally resolved and did its thing.

dgobaud commented 2 years ago

anyone have ideas?

in yarn.lock we have

"@passfolio/api-support-lib" "file:./local_dependencies/passfolio/api-support-lib.tgz"

somehow it starts looking in completely unrelated paths

error "../../../../../../../../Library/Caches/Yarn/v6/passfolio/api-support-lib.tgz": Tarball is not in network and can not be located in cache (["/Users/davidgobaud/Library/Caches/Yarn/v6/passfolio/api-support-lib.tgz","/Users/davidgobaud/Library/Caches/Yarn/v6/.tmp/680f266e419a18c2a69a574e6cb67595/.yarn-tarball.tgz"])

dgobaud commented 2 years ago

this seems relevant https://github.com/yarnpkg/yarn/issues/2861#issuecomment-682149275 but not sure how to fix it or what to do exactly

vaskoGut commented 2 years ago

@dgobaud any update? Have you found solution?

dgobaud commented 2 years ago

we have a pretty complicated setup using rush monorepo and many local packages.

rush uses pnpm but we deploy to google cloud which needs regular npm package.json file so we made a converter.

the problem had to do with nested libs - pretty specific to us - below is from our engineer who fixed it... maybe it is helpful.


Now that we are expanding the number of libraries we got to a problem with the path of the local dependencies. For example, suppose we are deploying price service. See the below folder structure:

The problem rises when a nested local dependency is used but not imported directly:

forest
  imports js-lib
    imports job-queue-lib
      imports metrics-lib -- this breaks, cannot resolve the library, tarball problem

fes
  imports job-queue-lib
    imports-metrics-lib
  imports js-lib
    imports job-queue-lib
      imports metrics-lib -- the doesn't break because fes is importing job-queue-lib directly, so it knows how to resolve metrics-lib

Solution: when packing the library (creating the .tgz), add all the libraries correct paths, even the ones not imported directly to the resolutions property inside package.json. So if some library is nested it will know how to find it. Sample from api-lib.tgz package.json file:

// wrong
"resolutions": {
  "__do_not_use__": "Ignored. Use <root>/common/config/package-resolutions.yaml instead",
}

// right
"resolutions": {
  "__do_not_use__": "Ignored. Use <root>/common/config/package-resolutions.yaml instead",
  "@passfolio/readonly-price-lib": "file:../../passfolio/readonly-price-lib.tgz",
  "@passfolio/api-lib": "file:../../passfolio/api-lib.tgz",
  "@passfolio/db-lib": "file:../../passfolio/db-lib.tgz",
  "@passfolio/graphing-lib": "file:../../passfolio/graphing-lib.tgz",
  "@passfolio/js-lib": "file:../../passfolio/js-lib.tgz",
  "@passfolio/lint": "file:../../passfolio/lint.tgz",
  "@passfolio/express-api-router-lib": "file:../../passfolio/express-api-router-lib.tgz",
  "@passfolio/cache-lib": "file:../../passfolio/cache-lib.tgz",
  "@passfolio/pg-timeseries-lib": "file:../../passfolio/pg-timeseries-lib.tgz",
  "@passfolio/timeseries-lib": "file:../../passfolio/timeseries-lib.tgz",
  "@passfolio/api-support-lib": "file:../../passfolio/api-support-lib.tgz",
  "@passfolio/math-lib": "file:../../passfolio/math-lib.tgz",
  "@passfolio/job-queue-lib": "file:../../passfolio/job-queue-lib.tgz",
  "@passfolio/scheduling-lib": "file:../../passfolio/scheduling-lib.tgz",
  "@passfolio/utils": "file:../../passfolio/utils.tgz",
  "@passfolio/metrics-lib": "file:../../passfolio/metrics-lib.tgz"
}
wayfarer3130 commented 6 months ago

This solution works for me for circleci installs, but not for netlify. My solution for netlify is to add a postinstall.js script that manually extracts the missing dependencies:

console.log('postinstall.js');

const { exec } = require('child_process');
const fs = require('fs');
const path = require('path');
const log = (err, stdout, stderr) => console.log(stdout);

if (!fs.existsSync(path.resolve(__dirname, './node_modules/dicom-microscopy-viewer'))) {
  const command = `tar -zxvf externals/external-dicom-microscopy-viewer/dicom-microscopy-viewer-0.46.1.tgz --transform s,package,dicom-microscopy-viewer, -C node_modules`
  console.log(command);
  exec(command, log);
}