Closed soullivaneuh closed 4 years ago
You can run npm i -D @types/express-serve-static-core
and then remove it after that. It should work. Alternatively, you can remove package-lock.json
and run npm i
to re-generate package-lock.json
Good point, it's probably a package lock problem. I usually run rm -rf node_modules package-lock.json && npm install
Running:
npm i -D @types/express-serve-static-core && npm remove @types/express-serve-static-core
Solves the issue and produced this diff:
diff --git a/package-lock.json b/package-lock.json
index 2da60b0..5fbde5a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -871,9 +871,9 @@
}
},
"@types/express-serve-static-core": {
- "version": "4.17.7",
- "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.7.tgz",
- "integrity": "sha512-EMgTj/DF9qpgLXyc+Btimg+XoH7A2liE8uKul8qSmMTHCeNYzydDKFdsJskDvw42UsesCnhO63dO0Grbj8J4Dw==",
+ "version": "4.17.13",
+ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.13.tgz",
+ "integrity": "sha512-RgDi5a4nuzam073lRGKTUIaL3eF2+H7LJvJ8eUnCI0wA6SNjXc44DCmWNiTLs/AZ7QlsFWZiw/gTG3nSQGL0fA==",
"requires": {
"@types/node": "*",
"@types/qs": "*",
However, this is a workaround, not a fix. Why this dependency is not bumped to the right version?
❯ npm list @types/express-serve-static-core
project@0.0.0 /project
├─┬ @feathersjs/express@4.5.9
│ └─┬ @types/express@4.17.8
│ ├── @types/express-serve-static-core@4.17.13
│ └─┬ @types/serve-static@1.13.3
│ └── @types/express-serve-static-core@4.17.13 deduped
└─┬ @types/compression@1.7.0
└─┬ @types/express@4.17.2
└── @types/express-serve-static-core@4.17.13 deduped
Now I got this error with v4.5.10
:
node_modules/@feathersjs/express/node_modules/@types/express/index.d.ts:59:29 - error TS2694: Namespace 'serveStatic' has no exported member 'RequestHandlerConstructor'.
59 var static: serveStatic.RequestHandlerConstructor<Response>;
~~~~~~~~~~~~~~~~~~~~~~~~~
Here is the new diff:
diff --git a/package.json b/package.json
index 0928a1b..576b9b6 100644
--- a/package.json
+++ b/package.json
@@ -34,28 +34,28 @@
},
"types": "lib/",
"dependencies": {
- "@feathersjs/authentication": "^4.5.9",
- "@feathersjs/authentication-local": "^4.5.9",
- "@feathersjs/authentication-oauth": "^4.5.9",
- "@feathersjs/configuration": "^4.5.9",
- "@feathersjs/errors": "^4.5.9",
- "@feathersjs/express": "^4.5.9",
- "@feathersjs/feathers": "^4.5.9",
- "@feathersjs/socketio": "^4.5.9",
- "@feathersjs/transport-commons": "^4.5.9",
+ "@feathersjs/authentication": "^4.5.10",
+ "@feathersjs/authentication-local": "^4.5.10",
+ "@feathersjs/authentication-oauth": "^4.5.10",
+ "@feathersjs/configuration": "^4.5.10",
+ "@feathersjs/errors": "^4.5.10",
+ "@feathersjs/express": "^4.5.10",
+ "@feathersjs/feathers": "^4.5.10",
+ "@feathersjs/socketio": "^4.5.10",
+ "@feathersjs/transport-commons": "^4.5.10",
"@googlemaps/google-maps-services-js": "^3.1.13",
"@hapi/joi": "^16.1.8",
"compression": "^1.7.4",
"cors": "^2.8.5",
- "date-holidays": "^1.7.1",
+ "date-holidays": "^1.8.3",
"feathers-hooks-common": "^5.0.4",
"feathers-nedb": "^5.1.0",
- "google-libphonenumber": "^3.2.13",
+ "google-libphonenumber": "^3.2.15",
"handlebars": "^4.7.6",
"helmet": "^3.23.3",
- "mangopay2-nodejs-sdk": "^1.14.2",
+ "mangopay2-nodejs-sdk": "^1.14.3",
"moment": "^2.29.1",
- "moment-timezone": "^0.5.31",
+ "moment-timezone": "^0.5.32",
"nedb": "^1.8.0",
"nexmo": "^2.9.1",
"node-fetch": "^2.6.1",
@@ -65,7 +65,7 @@
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
"@types/compression": "^1.7.0",
- "@types/cors": "^2.8.7",
+ "@types/cors": "^2.8.8",
"@types/faker": "^4.1.12",
"@types/fs-extra": "^8.1.1",
"@types/google-libphonenumber": "^7.4.19",
@@ -73,11 +73,11 @@
"@types/helmet": "0.0.45",
"@types/jest": "^24.9.1",
"@types/jsonwebtoken": "^8.5.0",
- "@types/lodash": "^4.14.161",
+ "@types/lodash": "^4.14.165",
"@types/mangopay2-nodejs-sdk": "^1.9.5",
"@types/nedb": "^1.8.11",
"@types/node-fetch": "^2.5.7",
- "@types/serve-favicon": "^2.5.0",
+ "@types/serve-favicon": "^2.5.1",
"axios": "^0.19.2",
"copyfiles": "^2.4.0",
"faker": "^4.1.0",
@@ -86,9 +86,9 @@
"jest": "^24.9.0",
"jest-extended": "^0.11.5",
"nodemon": "^1.19.4",
- "shx": "^0.3.2",
+ "shx": "^0.3.3",
"ts-jest": "^24.3.0",
- "ts-node-dev": "^1.0.0-pre.63",
+ "ts-node-dev": "^1.0.0",
"typescript": "^3.9.7"
}
}
Running the @types/express-serve-static-core
package hack did not solve this error.
This time, the @daffl rm -rf node_modules package-lock.json && npm install
command hack worked and produced a quite huge diff on the lock file.
I quite don't understand why those tricks. Don't why have any reliable solution to avoid this kind of issue? :thinking:
Sorry I had to remove the diff since it didn't have a lot of relevant information that can be reviewed. Package typings (especially Express) introduce unexpected breaking changes all the time (like https://github.com/feathersjs/feathers/pull/2126) which isn't really a Feathers specific problem. Making sure that all your dependencies are at the latest versions, removing the package-lock.json
and reinstalling is usually the safest option and fixes most of those problems.
Since this update diff:
The
npm run build
job (shx rm -rf lib/ && tsc
) fails with the following errors:Looks like a BC break to me, all is working great with the previous version.