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.4k stars 2.73k forks source link

Issue with offline installation of @types/node #4266

Open subyraman opened 7 years ago

subyraman commented 7 years ago

Do you want to request a feature or report a bug? Bug. @BYK suggested I repost this as a new issue.

What is the current behavior? Offline installation of JSDOM fails on the dependency @types/node. This was noted in #825 but does not seem fully resolved.

If the current behavior is a bug, please provide the steps to reproduce. The behavior occurs when the @types/node dependency hasn't been added to a lockfile; yarn searches through the cache and does not resolve the dependency properly.

sraman@sraman: bar$ yarn add jsdom@11.0.0 --offline
yarn add v0.27.5
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find any versions for "@types/node" that matches "^6.0.46" in our cache. Possible versions: ""
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

It is definitely available in my cache.

sraman@sraman: bar$ yarn cache ls | grep "@types"
@types/node                                          6.0.78                      npm      https://registry.yarnpkg.com/@types/node/-/node-6.0.78.tgz#5d4a3f579c1524e01ee21bf474e6fba09198f470
@types/node                                          6.0.87                      npm      https://registry.yarnpkg.com/@types/node/-/node-6.0.87.tgz#5ab5774f8351a33a935099fa6be850aa0b0ad564
@types/node                                          6.0.88                      npm      https://registry.yarnpkg.com/@types/node/-/node-6.0.88.tgz#f618f11a944f6a18d92b5c472028728a3e3d4b66
@types/node                                          8.0.25                      npm      https://registry.yarnpkg.com/@types/node/-/node-8.0.25.tgz#66ecaf4df93f5281b48427ee96fbcdfc4f0cdce1 

Same failure in the latest nightly:

sraman@sraman: bin$ ./yarn add jsdom@11.0.0 --offline
yarn add v1.0.0-20170825.1555
warning package.json: No license field
warning No license field
[1/4] πŸ”  Resolving packages...
error Couldn't find any versions for "@types/node" that matches "^6.0.46" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.

What is the expected behavior?

I expect JSDOM to be installed offline. Other cached packages work fine with offline installation and are resolved from the cache:

sraman@sraman: bin$ yarn add yargs@3.27.0 --offline
yarn add v0.27.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 18 new dependencies.
β”œβ”€ align-text@0.1.4
β”œβ”€ camelcase@1.2.1
β”œβ”€ center-align@0.1.3
β”œβ”€ cliui@2.1.0
β”œβ”€ decamelize@1.2.0
β”œβ”€ invert-kv@1.0.0
β”œβ”€ is-buffer@1.1.5
β”œβ”€ kind-of@3.2.2
β”œβ”€ lazy-cache@1.0.4
β”œβ”€ lcid@1.0.0
β”œβ”€ longest@1.0.1
β”œβ”€ os-locale@1.4.0
β”œβ”€ repeat-string@1.6.1
β”œβ”€ right-align@0.1.3
β”œβ”€ window-size@0.1.4
β”œβ”€ wordwrap@0.0.2
β”œβ”€ y18n@3.2.1
└─ yargs@3.27.0
Done in 0.90s.

Node: v6.7.0 Tested with Yarn 0.27.5 and nightly v1.0.0-20170825.1555 #

GAumala commented 7 years ago

I tried replicating this in yarn v0.28.4 and it's not fixed yet. But I don't really understand what is going on. Why does yarn try to find versions for @types/node? It is not listed as a dependency of jsdom@11.0.0

subyraman commented 7 years ago

@types/node is a dependency of parse5, which is listed in the dependencies there.

https://github.com/inikulin/parse5/blob/master/package.json

BYK commented 6 years ago

Maybe this is a bug with scoped packages?

sharno commented 6 years ago

I took a shot at this issue and described what I found in PR #4815

edit: I took another shot with the comments in the previous PR, and new changes are waiting to be reviewed in PR #4992

newren commented 6 years ago

We had pretty severe problems with scoped packages and offline mode, particularly around @types modules, and found a simple fix that I made available at #4822. It might be orthogonal to the issue reported here, but it sounded similar enough that I thought it was worth mentioning (at least for future folks doing google searches trying to find their problem and who come across this bug report)

assafmo commented 6 years ago

Still happens to me with 1.3.2 on ubuntu 16.04 with nodejs 9.3.0 and nodejs 7.7.4 and on ubuntu 17.10 with nodejs 9.3.0.

$ yarn add jest
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 359 new dependencies.
β”œβ”€ @babel/code-frame@7.0.0-beta.36
β”œβ”€ @types/node@8.5.2
β”œβ”€ abab@1.0.4
β”œβ”€ acorn-globals@4.1.0
β”œβ”€ acorn@5.2.1
β”œβ”€ ajv@5.5.2
β”œβ”€ align-text@0.1.4
β”œβ”€ amdefine@1.0.1
β”œβ”€ ansi-escapes@3.0.0
β”œβ”€ ansi-regex@2.1.1
β”œβ”€ ansi-styles@3.2.0
β”œβ”€ anymatch@1.3.2
β”œβ”€ append-transform@0.4.0
β”œβ”€ argparse@1.0.9
β”œβ”€ arr-diff@2.0.0
β”œβ”€ arr-flatten@1.1.0
β”œβ”€ array-equal@1.0.0
β”œβ”€ array-unique@0.2.1
β”œβ”€ arrify@1.0.1
β”œβ”€ asn1@0.2.3
β”œβ”€ assert-plus@1.0.0
β”œβ”€ astral-regex@1.0.0
β”œβ”€ async@2.6.0
β”œβ”€ asynckit@0.4.0
β”œβ”€ aws-sign2@0.7.0
β”œβ”€ aws4@1.6.0
β”œβ”€ babel-code-frame@6.26.0
β”œβ”€ babel-core@6.26.0
β”œβ”€ babel-generator@6.26.0
β”œβ”€ babel-helpers@6.24.1
β”œβ”€ babel-jest@22.0.4
β”œβ”€ babel-messages@6.23.0
β”œβ”€ babel-plugin-istanbul@4.1.5
β”œβ”€ babel-plugin-jest-hoist@22.0.3
β”œβ”€ babel-plugin-syntax-object-rest-spread@6.13.0
β”œβ”€ babel-preset-jest@22.0.3
β”œβ”€ babel-register@6.26.0
β”œβ”€ babel-runtime@6.26.0
β”œβ”€ babel-template@6.26.0
β”œβ”€ babel-traverse@6.26.0
β”œβ”€ babel-types@6.26.0
β”œβ”€ babylon@6.18.0
β”œβ”€ balanced-match@1.0.0
β”œβ”€ bcrypt-pbkdf@1.0.1
β”œβ”€ bindings@1.3.0
β”œβ”€ brace-expansion@1.1.8
β”œβ”€ braces@1.8.5
β”œβ”€ browser-process-hrtime@0.1.2
β”œβ”€ browser-resolve@1.11.2
β”œβ”€ bser@2.0.0
β”œβ”€ builtin-modules@1.1.1
β”œβ”€ callsites@2.0.0
β”œβ”€ camelcase@4.1.0
β”œβ”€ caseless@0.12.0
β”œβ”€ center-align@0.1.3
β”œβ”€ chalk@2.3.0
β”œβ”€ ci-info@1.1.2
β”œβ”€ cliui@3.2.0
β”œβ”€ co@4.6.0
β”œβ”€ code-point-at@1.1.0
β”œβ”€ color-convert@1.9.1
β”œβ”€ color-name@1.1.3
β”œβ”€ combined-stream@1.0.5
β”œβ”€ concat-map@0.0.1
β”œβ”€ content-type-parser@1.0.2
β”œβ”€ convert-source-map@1.5.1
β”œβ”€ core-js@2.5.3
β”œβ”€ core-util-is@1.0.2
β”œβ”€ cross-spawn@5.1.0
β”œβ”€ cssom@0.3.2
β”œβ”€ cssstyle@0.2.37
β”œβ”€ dashdash@1.14.1
β”œβ”€ debug@2.6.9
β”œβ”€ decamelize@1.2.0
β”œβ”€ deep-is@0.1.3
β”œβ”€ default-require-extensions@1.0.0
β”œβ”€ define-properties@1.1.2
β”œβ”€ delayed-stream@1.0.0
β”œβ”€ detect-indent@4.0.0
β”œβ”€ detect-newline@2.1.0
β”œβ”€ diff@3.4.0
β”œβ”€ domexception@1.0.0
β”œβ”€ ecc-jsbn@0.1.1
β”œβ”€ error-ex@1.3.1
β”œβ”€ es-abstract@1.10.0
β”œβ”€ es-to-primitive@1.1.1
β”œβ”€ escape-string-regexp@1.0.5
β”œβ”€ escodegen@1.9.0
β”œβ”€ esprima@4.0.0
β”œβ”€ estraverse@4.2.0
β”œβ”€ esutils@2.0.2
β”œβ”€ exec-sh@0.2.1
β”œβ”€ execa@0.7.0
β”œβ”€ expand-brackets@0.1.5
β”œβ”€ expand-range@1.8.2
β”œβ”€ expect@22.0.3
β”œβ”€ extend@3.0.1
β”œβ”€ extglob@0.3.2
β”œβ”€ extsprintf@1.3.0
β”œβ”€ fast-deep-equal@1.0.0
β”œβ”€ fast-json-stable-stringify@2.0.0
β”œβ”€ fast-levenshtein@2.0.6
β”œβ”€ fb-watchman@2.0.0
β”œβ”€ filename-regex@2.0.1
β”œβ”€ fileset@2.0.3
β”œβ”€ fill-range@2.2.3
β”œβ”€ find-up@2.1.0
β”œβ”€ for-in@1.0.2
β”œβ”€ for-own@0.1.5
β”œβ”€ foreach@2.0.5
β”œβ”€ forever-agent@0.6.1
β”œβ”€ form-data@2.3.1
β”œβ”€ fs.realpath@1.0.0
β”œβ”€ function-bind@1.1.1
β”œβ”€ get-caller-file@1.0.2
β”œβ”€ get-stream@3.0.0
β”œβ”€ getpass@0.1.7
β”œβ”€ glob-base@0.3.0
β”œβ”€ glob-parent@2.0.0
β”œβ”€ glob@7.1.2
β”œβ”€ globals@9.18.0
β”œβ”€ graceful-fs@4.1.11
β”œβ”€ growly@1.3.0
β”œβ”€ handlebars@4.0.11
β”œβ”€ har-schema@2.0.0
β”œβ”€ har-validator@5.0.3
β”œβ”€ has-ansi@2.0.0
β”œβ”€ has-flag@2.0.0
β”œβ”€ has@1.0.1
β”œβ”€ hoek@4.2.0
β”œβ”€ home-or-tmp@2.0.0
β”œβ”€ hosted-git-info@2.5.0
β”œβ”€ html-encoding-sniffer@1.0.2
β”œβ”€ http-signature@1.2.0
β”œβ”€ iconv-lite@0.4.19
β”œβ”€ imurmurhash@0.1.4
β”œβ”€ inflight@1.0.6
β”œβ”€ inherits@2.0.3
β”œβ”€ invariant@2.2.2
β”œβ”€ invert-kv@1.0.0
β”œβ”€ is-arrayish@0.2.1
β”œβ”€ is-buffer@1.1.6
β”œβ”€ is-builtin-module@1.0.0
β”œβ”€ is-callable@1.1.3
β”œβ”€ is-ci@1.0.10
β”œβ”€ is-date-object@1.0.1
β”œβ”€ is-dotfile@1.0.3
β”œβ”€ is-equal-shallow@0.1.3
β”œβ”€ is-extendable@0.1.1
β”œβ”€ is-extglob@1.0.0
β”œβ”€ is-finite@1.0.2
β”œβ”€ is-fullwidth-code-point@1.0.0
β”œβ”€ is-glob@2.0.1
β”œβ”€ is-number@2.1.0
β”œβ”€ is-posix-bracket@0.1.1
β”œβ”€ is-primitive@2.0.0
β”œβ”€ is-regex@1.0.4
β”œβ”€ is-stream@1.1.0
β”œβ”€ is-symbol@1.0.1
β”œβ”€ is-typedarray@1.0.0
β”œβ”€ is-utf8@0.2.1
β”œβ”€ isarray@1.0.0
β”œβ”€ isexe@2.0.0
β”œβ”€ isobject@2.1.0
β”œβ”€ isstream@0.1.2
β”œβ”€ istanbul-api@1.2.1
β”œβ”€ istanbul-lib-coverage@1.1.1
β”œβ”€ istanbul-lib-hook@1.1.0
β”œβ”€ istanbul-lib-instrument@1.9.1
β”œβ”€ istanbul-lib-report@1.1.2
β”œβ”€ istanbul-lib-source-maps@1.2.2
β”œβ”€ istanbul-reports@1.1.3
β”œβ”€ jest-changed-files@22.0.3
β”œβ”€ jest-cli@22.0.4
β”œβ”€ jest-config@22.0.4
β”œβ”€ jest-diff@22.0.3
β”œβ”€ jest-docblock@22.0.3
β”œβ”€ jest-environment-jsdom@22.0.4
β”œβ”€ jest-environment-node@22.0.4
β”œβ”€ jest-get-type@22.0.3
β”œβ”€ jest-haste-map@22.0.3
β”œβ”€ jest-jasmine2@22.0.4
β”œβ”€ jest-leak-detector@22.0.3
β”œβ”€ jest-matcher-utils@22.0.3
β”œβ”€ jest-message-util@22.0.3
β”œβ”€ jest-mock@22.0.3
β”œβ”€ jest-regex-util@22.0.3
β”œβ”€ jest-resolve-dependencies@22.0.3
β”œβ”€ jest-resolve@22.0.4
β”œβ”€ jest-runner@22.0.4
β”œβ”€ jest-runtime@22.0.4
β”œβ”€ jest-snapshot@22.0.3
β”œβ”€ jest-util@22.0.4
β”œβ”€ jest-validate@22.0.3
β”œβ”€ jest-worker@22.0.3
β”œβ”€ jest@22.0.4
β”œβ”€ js-tokens@3.0.2
β”œβ”€ js-yaml@3.10.0
β”œβ”€ jsbn@0.1.1
β”œβ”€ jsdom@11.5.1
β”œβ”€ jsesc@1.3.0
β”œβ”€ json-schema-traverse@0.3.1
β”œβ”€ json-schema@0.2.3
β”œβ”€ json-stable-stringify@1.0.1
β”œβ”€ json-stringify-safe@5.0.1
β”œβ”€ json5@0.5.1
β”œβ”€ jsonify@0.0.0
β”œβ”€ jsprim@1.4.1
β”œβ”€ kind-of@3.2.2
β”œβ”€ lazy-cache@1.0.4
β”œβ”€ lcid@1.0.0
β”œβ”€ left-pad@1.2.0
β”œβ”€ leven@2.1.0
β”œβ”€ levn@0.3.0
β”œβ”€ load-json-file@1.1.0
β”œβ”€ locate-path@2.0.0
β”œβ”€ lodash.sortby@4.7.0
β”œβ”€ lodash@4.17.4
β”œβ”€ longest@1.0.1
β”œβ”€ loose-envify@1.3.1
β”œβ”€ lru-cache@4.1.1
β”œβ”€ makeerror@1.0.11
β”œβ”€ mem@1.1.0
β”œβ”€ merge-stream@1.0.1
β”œβ”€ merge@1.2.0
β”œβ”€ micromatch@2.3.11
β”œβ”€ mime-db@1.30.0
β”œβ”€ mime-types@2.1.17
β”œβ”€ mimic-fn@1.1.0
β”œβ”€ minimatch@3.0.4
β”œβ”€ minimist@1.2.0
β”œβ”€ mkdirp@0.5.1
β”œβ”€ ms@2.0.0
β”œβ”€ nan@2.8.0
β”œβ”€ natural-compare@1.4.0
β”œβ”€ node-int64@0.4.0
β”œβ”€ node-notifier@5.1.2
β”œβ”€ normalize-package-data@2.4.0
β”œβ”€ normalize-path@2.1.1
β”œβ”€ npm-run-path@2.0.2
β”œβ”€ number-is-nan@1.0.1
β”œβ”€ nwmatcher@1.4.3
β”œβ”€ oauth-sign@0.8.2
β”œβ”€ object-assign@4.1.1
β”œβ”€ object-keys@1.0.11
β”œβ”€ object.getownpropertydescriptors@2.0.3
β”œβ”€ object.omit@2.0.1
β”œβ”€ once@1.4.0
β”œβ”€ optimist@0.6.1
β”œβ”€ optionator@0.8.2
β”œβ”€ os-homedir@1.0.2
β”œβ”€ os-locale@2.1.0
β”œβ”€ os-tmpdir@1.0.2
β”œβ”€ p-finally@1.0.0
β”œβ”€ p-limit@1.1.0
β”œβ”€ p-locate@2.0.0
β”œβ”€ parse-glob@3.0.4
β”œβ”€ parse-json@2.2.0
β”œβ”€ parse5@3.0.3
β”œβ”€ path-exists@3.0.0
β”œβ”€ path-is-absolute@1.0.1
β”œβ”€ path-key@2.0.1
β”œβ”€ path-parse@1.0.5
β”œβ”€ path-type@1.1.0
β”œβ”€ performance-now@2.1.0
β”œβ”€ pify@2.3.0
β”œβ”€ pinkie-promise@2.0.1
β”œβ”€ pinkie@2.0.4
β”œβ”€ pn@1.0.0
β”œβ”€ prelude-ls@1.1.2
β”œβ”€ preserve@0.2.0
β”œβ”€ pretty-format@22.0.3
β”œβ”€ private@0.1.8
β”œβ”€ process-nextick-args@1.0.7
β”œβ”€ pseudomap@1.0.2
β”œβ”€ punycode@1.4.1
β”œβ”€ qs@6.5.1
β”œβ”€ randomatic@1.1.7
β”œβ”€ read-pkg-up@1.0.1
β”œβ”€ read-pkg@1.1.0
β”œβ”€ readable-stream@2.3.3
β”œβ”€ realpath-native@1.0.0
β”œβ”€ regenerator-runtime@0.11.1
β”œβ”€ regex-cache@0.4.4
β”œβ”€ remove-trailing-separator@1.1.0
β”œβ”€ repeat-element@1.1.2
β”œβ”€ repeat-string@1.6.1
β”œβ”€ repeating@2.0.1
β”œβ”€ request-promise-core@1.1.1
β”œβ”€ request-promise-native@1.0.5
β”œβ”€ request@2.83.0
β”œβ”€ require-directory@2.1.1
β”œβ”€ require-main-filename@1.0.1
β”œβ”€ resolve@1.1.7
β”œβ”€ right-align@0.1.3
β”œβ”€ rimraf@2.6.2
β”œβ”€ safe-buffer@5.1.1
β”œβ”€ sane@2.2.0
β”œβ”€ sax@1.2.4
β”œβ”€ semver@5.4.1
β”œβ”€ set-blocking@2.0.0
β”œβ”€ shebang-command@1.2.0
β”œβ”€ shebang-regex@1.0.0
β”œβ”€ shellwords@0.1.1
β”œβ”€ signal-exit@3.0.2
β”œβ”€ slash@1.0.0
β”œβ”€ source-map-support@0.5.0
β”œβ”€ source-map@0.5.7
β”œβ”€ spdx-correct@1.0.2
β”œβ”€ spdx-expression-parse@1.0.4
β”œβ”€ spdx-license-ids@1.2.2
β”œβ”€ sprintf-js@1.0.3
β”œβ”€ sshpk@1.13.1
β”œβ”€ stack-utils@1.0.1
β”œβ”€ stealthy-require@1.1.1
β”œβ”€ string_decoder@1.0.3
β”œβ”€ string-length@2.0.0
β”œβ”€ string-width@1.0.2
β”œβ”€ stringstream@0.0.5
β”œβ”€ strip-ansi@3.0.1
β”œβ”€ strip-bom@2.0.0
β”œβ”€ strip-eof@1.0.0
β”œβ”€ supports-color@4.5.0
β”œβ”€ symbol-tree@3.2.2
β”œβ”€ test-exclude@4.1.1
β”œβ”€ throat@4.1.0
β”œβ”€ tmpl@1.0.4
β”œβ”€ to-fast-properties@1.0.3
β”œβ”€ tough-cookie@2.3.3
β”œβ”€ tr46@1.0.1
β”œβ”€ trim-right@1.0.1
β”œβ”€ tunnel-agent@0.6.0
β”œβ”€ tweetnacl@0.14.5
β”œβ”€ type-check@0.3.2
β”œβ”€ uglify-js@2.8.29
β”œβ”€ uglify-to-browserify@1.0.2
β”œβ”€ util-deprecate@1.0.2
β”œβ”€ util.promisify@1.0.0
β”œβ”€ uuid@3.1.0
β”œβ”€ validate-npm-package-license@3.0.1
β”œβ”€ verror@1.10.0
β”œβ”€ walker@1.0.7
β”œβ”€ watch@0.18.0
β”œβ”€ weak@1.0.1
β”œβ”€ webidl-conversions@4.0.2
β”œβ”€ whatwg-encoding@1.0.3
β”œβ”€ whatwg-url@6.4.0
β”œβ”€ which-module@2.0.0
β”œβ”€ which@1.3.0
β”œβ”€ window-size@0.1.0
β”œβ”€ wordwrap@0.0.3
β”œβ”€ wrap-ansi@2.1.0
β”œβ”€ wrappy@1.0.2
β”œβ”€ write-file-atomic@2.3.0
β”œβ”€ xml-name-validator@2.0.1
β”œβ”€ y18n@3.2.1
β”œβ”€ yallist@2.1.2
β”œβ”€ yargs-parser@8.1.0
└─ yargs@10.0.3
Done in 7.48s.
$ rm -rf node_modules package.json yarn.lock
$ yarn add --offline jest 
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find any versions for "@types/node" that matches "*" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Couldn't find any versions for "@babel/code-frame" that matches "^7.0.0-beta.35" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
    at /usr/local/lib/node_modules/yarn/lib/cli.js:49034:15
    at Generator.next (<anonymous>)
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:92:30)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:103:13
    at <anonymous>

I definitely have those in the cache:

$ yarn cache list | grep -E '@types/node|@babel/code-frame'
@babel/code-frame                                    7.0.0-beta.35 npm      https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.35.tgz#04eeb6dca7efef8f65776a4c214157303b85ad51                                                                      
@babel/code-frame                                    7.0.0-beta.36 npm      https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz#2349d7ec04b3a06945ae173280ef8579b63728e4                                                                      
@types/node                                          8.5.2         npm      https://registry.yarnpkg.com/@types/node/-/node-8.5.2.tgz#83b8103fa9a2c2e83d78f701a9aa7c9539739aa5 

EDIT: added more outputs