Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: iterall not in package.json #537

Closed
andreialecu opened this issue Dec 28, 2019 · 4 comments · Fixed by #538
Closed

Bug: iterall not in package.json #537

andreialecu opened this issue Dec 28, 2019 · 4 comments · Fixed by #538

Comments

@andreialecu
Copy link
Contributor

import { $$asyncIterator } from 'iterall';

This library imports iterall but it is not defined in package.json.

This is a problem with yarn v2, the upcoming version of yarn, resulting in errors such as:

Cannot find module 'iterall' from 'async-iterator.util.js'

      at Resolver.resolveModule (../.yarn/cache/jest-resolve-npm-24.9.0-56dbaf2e7d-1.zip/node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (../.yarn/virtual/@nestjs-graphql-virtual-9a8fdb1b99/0/cache/@nestjs-graphql-npm-6.5.3-98b2ad3bf3-1.zip/node_modules/@nestjs/graph
ql/dist/utils/async-iterator.util.js:12:19)

The library should be added to dependencies.

@andreialecu
Copy link
Contributor Author

This probably worked before because of the behavior described in this comment:

yarnpkg/berry#271 (comment)

@kamilmysliwiec
Copy link
Member

This issue is not related to NestJS

@andreialecu
Copy link
Contributor Author

andreialecu commented Dec 28, 2019

???

This package is using a library not defined in its package.json. How is this not related?

The only reason it works now is because of a "bug" or undocumented feature in previous versions of npm or yarn, but definitely not something to be relied on. There's a separate dependency that is installing iterall and this package is stealing it, but that's definitely bad practice.

andreialecu added a commit to andreialecu/graphql that referenced this issue Dec 28, 2019
iterall was imported without being in package.json

This works in some environments because the package steals iterall from its sub dependencies, but it is not a good practice and not compatible with https://yarnpkg.com/lang/en/docs/pnp/ and with upcoming similar features from npm

This is a bad practice in general: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md

Fixes nestjs#537
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants