Not getting express or body parser d.ts config files to be read by render

I keep getting this build failing due to express and body-parser not being found

src/webpage/index.ts(1,49): error TS7016: Could not find a declaration file for module ‘express’. ‘/opt/render/project/src/node_modules/express/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/express if it exists or add a new declaration (.d.ts) file containing declare module 'express';

Jan 24 09:23:10 PMsrc/webpage/index.ts(3,21): error TS7016: Could not find a declaration file for module ‘express’. ‘/opt/render/project/src/node_modules/express/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/express if it exists or add a new declaration (.d.ts) file containing declare module 'express';

Jan 24 09:23:10 PMsrc/webpage/index.ts(6,24): error TS7016: Could not find a declaration file for module ‘body-parser’. ‘/opt/render/project/src/node_modules/body-parser/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/body-parser if it exists or add a new declaration (.d.ts) file containing declare module 'body-parser';

Jan 24 09:23:10 PMsrc/webpage/routes/commands.ts(1,49): error TS7016: Could not find a declaration file for module ‘express’. ‘/opt/render/project/src/node_modules/express/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/express if it exists or add a new declaration (.d.ts) file containing declare module 'express';

Jan 24 09:23:10 PMsrc/webpage/routes/commands.ts(3,21): error TS7016: Could not find a declaration file for module ‘express’. ‘/opt/render/project/src/node_modules/express/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/express if it exists or add a new declaration (.d.ts) file containing declare module 'express';

Jan 24 09:23:10 PMsrc/webpage/routes/crypto.ts(1,49): error TS7016: Could not find a declaration file for module ‘express’. ‘/opt/render/project/src/node_modules/express/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/express if it exists or add a new declaration (.d.ts) file containing declare module 'express';

Jan 24 09:23:10 PMsrc/webpage/routes/crypto.ts(3,26): error TS7016: Could not find a declaration file for module ‘express’. ‘/opt/render/project/src/node_modules/express/index.js’ implicitly has an ‘any’ type.

Jan 24 09:23:10 PM Try npm i --save-dev @types/express if it exists or add a new declaration (.d.ts) file containing declare module 'express';

Tsconfig file in root:
{
“compilerOptions”: {
“target”: “es6”,
“module”: “commonjs”,
“lib”: [“dom”, “es6”],
“allowJs”: true,
“outDir”: “dist”,
“declaration”: true,
“rootDir”: “src”,
“strict”: true,
“noImplicitAny”: true,
“esModuleInterop”: true,
“resolveJsonModule”: true,
“skipLibCheck”: true,
“typeRoots”: [“./node_modules/@types”]
},
“exclude”: [“node_modules”],
“include”: [“./src/**/*.ts”]
}

Tsconfig in src
{
“compilerOptions”: {
“target”: “es6”,
“module”: “commonjs”,
“lib”: [“es6”],
“allowJs”: true,
“outDir”: “dist”,
“rootDir”: “…/src”,
“strict”: true,
“noImplicitAny”: true,
“esModuleInterop”: true,
“typeRoots”: [“…/node_modules/@types”],
“resolveJsonModule”: true
}
}

Hi Benry,

It looks like you might need to add @types/express to your package.json.

Could you give that a try and let me know how it goes?

Regards,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.