Closed sannajammeh closed 3 years ago
@types/tapable
was updated today and breaks @types/webpack
which is a dependency of @nestjs/cli
. There's not much Nest can do about this, as the @types/webpack
uses the most recent version of @types/tapable
.
same issue..
Again, there's nothing nest can really do about this. The @types/webpack
repository needs to be informed of the issue and have their version pinned rather than using the most recent. Then we can pin our @types/webpack
version and fix the issue
Hi! Thanks for the clarification @jmcdo29. Your comment took me to the @types
repository, and this PR specifically. It looks like it could be related.
After running npm install
in a new nestjs
project and looking at the package-lock.json
, It looks like it could be that nestjs
installs "@types/webpack": "4.41.26"
but uses "webpack": "5.11.0"
.
Running npm install --save-dev @types/webpack
to get the latest webpack types fixes the majority of the type issues.
The remaining errors come from the @types/webpack
and @types/tapable
directly. The errors are:
> nest build
node_modules/@types/tapable/index.d.ts:7:15 - error TS2307: Cannot find module './node_modules/tapable' or its corresponding type declarations.
7 export * from './node_modules/tapable';
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/webpack/index.d.ts:29:26 - error TS2307: Cannot find module './node_modules/webpack' or its corresponding type declarations.
29 import webpack = require('./node_modules/webpack');
~~~~~~~~~~~~~~~~~~~~~~~~
Found 2 error(s).
I'm a little unfamiliar with @types
and how the webpack
and tapable
libraries seem to be re-exporting their own webpack
and tapable
dependencies, rather than the ones resolved by node.
It looks like new types that are included with both webpack and tapable are clashing with the versions provided by DefinitelyTyped.
npm uninstall --save @types/webpack @types/tapable
Seems to fix the issue for me. So maybe just need to update the package.json template to not include them?
It looks like new types that are included with both webpack and tapable are clashing with the versions provided by DefinitelyTyped.
npm uninstall --save @types/webpack @types/tapable
Seems to fix the issue for me. So maybe just need to update the package.json template to not include them?
Simply uninstalling those packages did not help for me. I ran into this problem today while setting up the typescript-starter project and trying out for the first time with NestJS (terrible timing, for a minute I thought NestJS was awful and I'd made a horrible mistake haha..eventually figured out its an upstream issue and totally not NestJS fault).
In any case, for me I managed to work around this issue by doing the following in the https://github.com/nestjs/typescript-starter project:
yarn add tapable@1.1.3
yarn add -D @types/webpack # (which installed v5.0.0 of @types/webpack)
I'm now at least able to start Nest and start playing around with it, but beware anyone that uses this workaround; given I literally took my first look at NestJS today, this was brute-force solved via trial and error, and I might've missed something important.
It looks like new types that are included with both webpack and tapable are clashing with the versions provided by DefinitelyTyped.
npm uninstall --save @types/webpack @types/tapable
Seems to fix the issue for me. So maybe just need to update the package.json template to not include them?
Simply uninstalling those packages did not help for me. I ran into this problem today while setting up the typescript-starter project and trying out for the first time with NestJS (terrible timing, for a minute I thought NestJS was awful and I'd made a horrible mistake haha..eventually figured out its an upstream issue and totally not NestJS fault).
In any case, for me I managed to work around this issue by doing the following in the https://github.com/nestjs/typescript-starter project:
yarn add tapable@1.1.3 yarn add -D @types/webpack # (which installed v5.0.0 of @types/webpack)
I'm now at least able to start Nest and start playing around with it, but beware anyone that uses this workaround; given I literally took my first look at NestJS today, this was brute-force solved via trial and error, and I might've missed something important.
It works for me.
It worked with these versions for me
npm i @types/webpack@4.41.27
npm i tapable@1.1.3
It worked with these versions for me
npm i @types/webpack@4.41.27
npm i tapable@1.1.3
It works for me
Bug Report
Something has broken while preparing for production deployment. Due to other reasons, I had to delete my yarn lock file and I started getting error messages. It builds just fine in development, however, it displays over 90 errors of missing @types packages from @types/webpack and @types/tapable. This breaks the production build. I've tried reinstalling packages with npm and yarn, deleting node_modules, lock files, and also removing the yarn cache, all to no avail. I thought there was something wrong with my project so I created a new test project with the NestJS CLI and the latest version, still the same issue.
Current behavior
Below is the complete error message I receive in my console when running npm run build:
Input Code
Reproduce: install the latest nestjs cli and creat a new project, CD into the folder and run
npm install && npm run build
Expected behavior
Should build fine without any type errors due to missing dependencies.
Possible Solution
Environment