How to fix error: Namespace ‘serveStatic’ has no exported member ‘RequestHandlerConstructor’


Example error:

D:\TS-doc\nest>typedoc --mode file --out ..doc/@nestjs/core packages/core --read
me packages/core/Readme.md --target ES2015

Using TypeScript 3.9.7 from C:\Users\Administrator\AppData\Roaming\nvm\v14.7.0\n
ode_modules\typescript\lib
Error: D:/TS-doc/nest/node_modules/@types/express/index.d.ts(58)
 Namespace 'serveStatic' has no exported member 'RequestHandlerConstructor'.

How to fix this error?

Step 1:
npm update @types/express-serve-static-core --depth 2

Result:

D:\TS-doc\nest>npm update @types/express-serve-static-core --depth 2
npm WARN @nestjs/graphql@7.8.2 requires a peer of @nestjs/common@^7.0.0 but none
 is installed. You must install peer dependencies yourself.
npm WARN @nestjs/graphql@7.8.2 requires a peer of @nestjs/core@^7.0.0 but none i
s installed. You must install peer dependencies yourself.
npm WARN @nestjs/mapped-types@0.1.1 requires a peer of @nestjs/common@^7.0.8 but
 none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/mongoose@7.1.2 requires a peer of @nestjs/common@^6.0.0 || ^7.0
.0 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/mongoose@7.1.2 requires a peer of @nestjs/core@^6.0.0 || ^7.0.0
 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/typeorm@7.1.5 requires a peer of @nestjs/common@^6.7.0 || ^7.0.
0 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/typeorm@7.1.5 requires a peer of @nestjs/core@^6.7.0 || ^7.0.0
but none is installed. You must install peer dependencies yourself.
npm WARN apollo-graphql@0.4.5 requires a peer of graphql@^14.2.1 but none is ins
talled. You must install peer dependencies yourself.
npm WARN apollo-link@1.2.13 requires a peer of graphql@^0.11.3 || ^0.12.3 || ^0.
13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourse
lf.
npm WARN apollo-utilities@1.3.2 requires a peer of graphql@^0.11.0 || ^0.12.0 ||
 ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yo
urself.
npm WARN awesome-typescript-loader@5.2.1 requires a peer of typescript@^2.7 || ^
3 but none is installed. You must install peer dependencies yourself.
npm WARN commitlint-circle@1.0.0 requires a peer of @commitlint/cli@^7.0.0 but n
one is installed. You must install peer dependencies yourself.
npm WARN graphql-subscriptions@1.1.0 requires a peer of graphql@^0.10.5 || ^0.11
.3 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer
 dependencies yourself.
npm WARN graphql-tag@2.10.3 requires a peer of graphql@^0.9.0 || ^0.10.0 || ^0.1
1.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install pee
r dependencies yourself.
npm WARN graphql-upload@8.1.0 requires a peer of graphql@0.13.1 - 14 but none is
 installed. You must install peer dependencies yourself.
npm WARN imports-loader@1.2.0 requires a peer of webpack@^4.0.0 || ^5.0.0 but no
ne is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\@ne
stjs\graphql\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\@ty
pes\gulp\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\nod
emon\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\moc
ha\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)

+ @types/express-serve-static-core@4.17.14
added 7 packages from 9 contributors, removed 9 packages, updated 1 package and
audited 3040 packages in 36.806s

109 packages are looking for funding
  run `npm fund` for details

found 635 vulnerabilities (537 low, 98 high)
  run `npm audit fix` to fix them, or `npm audit` for details

> core-js@3.8.0 postinstall D:\TS-doc\nest\node_modules\apollo-server-express\no
de_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfill
ing JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Colle
ctive or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a goo
d job -)


> @apollo/protobufjs@1.0.5 postinstall D:\TS-doc\nest\node_modules\apollo-server
-express\node_modules\@apollo\protobufjs
> node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN graphql-upload@8.1.0 requires a peer of graphql@0.13.1 - 14 but none is
 installed. You must install peer dependencies yourself.

+ @types/express-serve-static-core@4.17.14
added 109 packages from 170 contributors, updated 1 package and audited 127 pack
ages in 26.26s

19 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Step 2:
npm update @types/serve-static --depth 2

Result:

D:\TS-doc\nest>npm update @types/serve-static --depth 2
npm WARN @nestjs/graphql@7.8.2 requires a peer of @nestjs/common@^7.0.0 but none
 is installed. You must install peer dependencies yourself.
npm WARN @nestjs/graphql@7.8.2 requires a peer of @nestjs/core@^7.0.0 but none i
s installed. You must install peer dependencies yourself.
npm WARN @nestjs/mapped-types@0.1.1 requires a peer of @nestjs/common@^7.0.8 but
 none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/mongoose@7.1.2 requires a peer of @nestjs/common@^6.0.0 || ^7.0
.0 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/mongoose@7.1.2 requires a peer of @nestjs/core@^6.0.0 || ^7.0.0
 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/typeorm@7.1.5 requires a peer of @nestjs/common@^6.7.0 || ^7.0.
0 but none is installed. You must install peer dependencies yourself.
npm WARN @nestjs/typeorm@7.1.5 requires a peer of @nestjs/core@^6.7.0 || ^7.0.0
but none is installed. You must install peer dependencies yourself.
npm WARN apollo-graphql@0.4.5 requires a peer of graphql@^14.2.1 but none is ins
talled. You must install peer dependencies yourself.
npm WARN apollo-link@1.2.13 requires a peer of graphql@^0.11.3 || ^0.12.3 || ^0.
13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourse
lf.
npm WARN apollo-utilities@1.3.2 requires a peer of graphql@^0.11.0 || ^0.12.0 ||
 ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yo
urself.
npm WARN awesome-typescript-loader@5.2.1 requires a peer of typescript@^2.7 || ^
3 but none is installed. You must install peer dependencies yourself.
npm WARN commitlint-circle@1.0.0 requires a peer of @commitlint/cli@^7.0.0 but n
one is installed. You must install peer dependencies yourself.
npm WARN graphql-subscriptions@1.1.0 requires a peer of graphql@^0.10.5 || ^0.11
.3 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer
 dependencies yourself.
npm WARN graphql-tag@2.10.3 requires a peer of graphql@^0.9.0 || ^0.10.0 || ^0.1
1.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install pee
r dependencies yourself.
npm WARN graphql-upload@8.1.0 requires a peer of graphql@0.13.1 - 14 but none is
 installed. You must install peer dependencies yourself.
npm WARN imports-loader@1.2.0 requires a peer of webpack@^4.0.0 || ^5.0.0 but no
ne is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\@ne
stjs\graphql\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\@ty
pes\gulp\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\nod
emon\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\moc
ha\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)

+ @types/serve-static@1.13.8
removed 109 packages, updated 2 packages and audited 3040 packages in 36.533s

109 packages are looking for funding
  run `npm fund` for details

found 635 vulnerabilities (537 low, 98 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Done!

Recent search terms:

  • error TS2694: Namespace serveStatic has no exported member RequestHandlerConstructor

1 Comment

Leave a Reply