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

@types/node not recognized #166

Closed
abdulrahman1s opened this issue Jun 3, 2022 · 5 comments · Fixed by #170
Closed

@types/node not recognized #166

abdulrahman1s opened this issue Jun 3, 2022 · 5 comments · Fixed by #170
Labels
bug Something isn't working

Comments

@abdulrahman1s
Copy link

{
  packageManager: 'pnpm',
  scriptModule: false,
  test: false,
  entryPoints: ['./mod.ts'],
  outDir: './npm',
  shims: {},
  compilerOptions: {
    target: "ES2021",
  },
  package: {
    name: '@itchatapp/migrations',
    version: Deno.args[0].replace(/[A-Z]+/gi, ''),
    description: 'migrations module for itchat',
    license: 'MIT',
    devDependencies: {
      "@types/node": "16.x",
    },
    repository: {
      type: 'git',
      url: 'git+https://github.com/itchatapp/migrations.git',
    },
    bugs: {
      url: 'https://github.com/itchatapp/migrations/issues',
    },
    engines: {
      node: '>=16.0.0',
    },
    files: [
      'esm/*',
      'types/*',
    ],
  },
}
Logs:
[dnt] Transforming...
[dnt] Running pnpm install...
Packages: +1
+
Packages are cloned from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/abdulrahman/.local/share/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 1, reused 1, downloaded 0, added 1, done

devDependencies:
+ @types/node 16.11.37 (17.0.38 is available)
[dnt] Building project...
[dnt] Type checking...
npm/src/src/lib.ts:1:22 - error TS2307: Cannot find module 'path' or its corresponding type declarations.

1 import { join } from 'path';
                       ~~~~~~
npm/src/src/lib.ts:2:16 - error TS2307: Cannot find module 'fs' or its corresponding type declarations.

2 import fs from 'fs';
                 ~~~~
npm/src/src/lib.ts:18:14 - error TS7006: Parameter 'x' implicitly has an 'any' type.

18     .filter((x) =>
                ~
npm/src/src/lib.ts:22:11 - error TS7006: Parameter 'x' implicitly has an 'any' type.

22     .map((x) => ({
             ~

error: Uncaught (in promise) Error: Had 4 diagnostics.
      throw new Error(`Had ${diagnostics.length} diagnostics.`);

version: 0.24.0 (I also tried 0.23.0 and 0.22.0 all of them the same result)

@dsherret
Copy link
Member

dsherret commented Jun 3, 2022

@abdulrahman1s do you have a branch I could try out to reproduce the problem? Everything you're doing there looks fine.

Does it work when you don't use pnpm?

@abdulrahman1s
Copy link
Author

@dsherret I did try npm with different versions of @types/node.. everything wont work
the build process fail on my arch linux as well as github action.

@dsherret
Copy link
Member

dsherret commented Jun 3, 2022

Thanks for reporting this @abdulrahman1s and for the reproduction. It should be fixed now in 0.25.1. I'm surprised that this wasn't encountered before... I guess probably some other conditions were triggering the @types/node packages to be included in other scenarios.

@abdulrahman1s
Copy link
Author

abdulrahman1s commented Jun 3, 2022

@dsherret Thanks it works now!
I did try the newer version and it works for npm!
but unfortunately the same results with pnpm

@dsherret
Copy link
Member

dsherret commented Jun 3, 2022

@abdulrahman1s the pnpm issue should be fixed if you import the latest main commit: https://raw.githubusercontent.com/denoland/dnt/621cd2424efec0ed62081b1e94b37d212a6a9ab9/mod.ts -- I'll do a release later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants