I'm trying to upload an image to the server using multer and multer-s3. but i am not able to declare the multer-s3 package. showing
Error: Cannot find module '@aws-sdk/abort-controller'
this is the declaration code
const multers3 = require('multer-s3');
ERROR
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '@aws-sdk/abort-controller'
Require stack:
- /Users/venkat/ecom_server/node_modules/@aws-sdk/lib-storage/dist-cjs/Upload.js
- /Users/venkat/ecom_server/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js
- /Users/venkat/ecom_server/node_modules/multer-s3/index.js
- /Users/venkat/ecom_server/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/venkat/ecom_server/node_modules/@aws-sdk/lib-storage/dist-cjs/Upload.js:4:28)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/venkat/ecom_server/node_modules/@aws-sdk/lib-storage/dist-cjs/Upload.js',
'/Users/venkat/ecom_server/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js',
'/Users/venkat/ecom_server/node_modules/multer-s3/index.js',
'/Users/venkat/ecom_server/index.js'
]
}
node version: v16.15.1
I faced a similar issue. And it was this particular line from the official npm documentation of multer-s3 that solved the issue:
In short, if you are using v2 of aws-sdk, use version 2.x.x of multer-s3, and for v3 of aws-sdk, use 3.x.x of multer-s3.