Can’t resolve ‘./zstd.win32-x64-msvc.node’ in …node_modules/@mongodb-js/zstd

I have a react node js typescript project I’m working on via my m2 chip mac where I’m trying to get MongoDB and mongoose setup on.

I’ve installed the basic mongodb package via npm and am getting the above error as well as the following:

WARNING in ./node_modules/@mongodb-js/zstd/index.js 31:28-65
Module not found: Error: Can't resolve './zstd.win32-x64-msvc.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 33:28-70
Module not found: Error: Can't resolve '@mongodb-js/zstd-win32-x64-msvc' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 49:28-61
Module not found: Error: Can't resolve './zstd.darwin-x64.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 51:28-66
Module not found: Error: Can't resolve '@mongodb-js/zstd-darwin-x64' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 61:28-63
Module not found: Error: Can't resolve './zstd.darwin-arm64.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 80:30-67
Module not found: Error: Can't resolve './zstd.linux-x64-musl.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 82:30-72
Module not found: Error: Can't resolve '@mongodb-js/zstd-linux-x64-musl' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 91:30-66
Module not found: Error: Can't resolve './zstd.linux-x64-gnu.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 93:30-71
Module not found: Error: Can't resolve '@mongodb-js/zstd-linux-x64-gnu' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 105:30-69
Module not found: Error: Can't resolve './zstd.linux-arm64-musl.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 107:30-74
Module not found: Error: Can't resolve '@mongodb-js/zstd-linux-arm64-musl' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 116:30-68
Module not found: Error: Can't resolve './zstd.linux-arm64-gnu.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 118:30-73
Module not found: Error: Can't resolve '@mongodb-js/zstd-linux-arm64-gnu' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 129:28-70
Module not found: Error: Can't resolve './zstd.linux-arm-gnueabihf.node' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/@mongodb-js/zstd/index.js 131:28-75
Module not found: Error: Can't resolve '@mongodb-js/zstd-linux-arm-gnueabihf' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/@mongodb-js/zstd'
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
@ ./node_modules/express/lib/application.js 22:11-28
@ ./node_modules/express/lib/express.js 18:12-36
@ ./node_modules/express/index.js 11:0-41
@ ./server/index.ts 8:34-52

WARNING in ./node_modules/mongodb/lib/deps.js 23:19-38
Module not found: Error: Can't resolve 'kerberos' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/mongodb/lib/deps.js 45:35-75
Module not found: Error: Can't resolve '@aws-sdk/credential-providers' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/mongodb/lib/deps.js 57:35-58
Module not found: Error: Can't resolve 'gcp-metadata' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/mongodb/lib/deps.js 69:22-39
Module not found: Error: Can't resolve 'snappy' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/mongodb/lib/deps.js 81:22-38
Module not found: Error: Can't resolve 'socks' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/mongodb/lib/deps.js 94:15-30
Module not found: Error: Can't resolve 'aws4' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

WARNING in ./node_modules/mongodb/lib/deps.js 108:34-70
Module not found: Error: Can't resolve 'mongodb-client-encryption' in '/Users/nikoicardo/Desktop/node.js projects/propertyManage/propertyManage/node_modules/mongodb/lib'
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

23 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/@mongodb-js/zstd-darwin-arm64/zstd.darwin-arm64.node 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
@ ./node_modules/@mongodb-js/zstd/index.js 63:28-68
@ ./node_modules/mongodb/lib/deps.js 34:20-47
@ ./node_modules/mongodb/lib/client-side-encryption/client_encryption.js 5:15-33
@ ./node_modules/mongodb/lib/index.js 61:26-79
@ ./server/db/connectDb.ts 13:18-36
@ ./server/index.ts 11:20-45

Whats weird is its seemingly looking for other OS related packaged in my installation. Am I doing something wrong with installing mongodb? For reference, here is my package.json and webpack.server.config.js`

package.json:

{
  "name": "propertymanage",
  "version": "1.0.0",
  "description": "a property management portal for tenants and owners",
  "main": "index.ts",
  "scripts": {
    "start": "node ./dist-server/server.js",
    "dev": "concurrently "npm run front" "npm run back"",
    "front": "webpack serve --config webpack.client.config.mjs",
    "back": "nodemon --watch 'server/**/*.ts' --exec 'webpack --config webpack.server.config.mjs && node dist-server/server.js' --ext ts",
    "build": "npm run build:client && npm run build:server",
    "build:client": "webpack --config webpack.client.config.mjs --mode production",
    "build:server": "webpack --config webpack.server.config.mjs --mode production"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/bcryptjs": "^2.4.6",
    "@types/react": "^18.3.3",
    "@types/react-dom": "^18.3.0",
    "axios": "^1.7.2",
    "bcryptjs": "^2.4.3",
    "concurrently": "^8.2.2",
    "css-loader": "^7.1.2",
    "install": "^0.13.0",
    "mongodb": "^6.8.0",
    "postcss-loader": "^8.1.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-redux": "^9.1.2",
    "react-router-dom": "^6.24.1",
    "redux": "^5.0.1",
    "redux-thunk": "^3.1.0",
    "style-loader": "^4.0.0",
    "ts-loader": "^9.5.1",
    "typescript": "^5.5.3",
    "url": "^0.11.3",
    "webpack": "^5.92.1",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^5.0.4"
  },
  "devDependencies": {
    "@types/node": "^20.14.10",
    "autoprefixer": "^10.4.19",
    "postcss": "^8.4.39",
    "tailwindcss": "^3.4.4"
  }
}

webpack.server.config.js:

 import path from "path";
      import { fileURLToPath } from "url";
      const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
      const __dirname = path.dirname(__filename); // get the name of the directory

      export default {
            entry: "./server/index.ts", // Entry point of your server-side TypeScript code
            target: "node", // Compile for Node.js environment
            output: {
            path: path.resolve(__dirname, "dist-server"), // Output directory for server build
                filename: "server.js", // Output file name
            },
            devtool: "source-map", // Enable source maps for easier debugging
            resolve: {
                extensions: [".ts", ".js", ".node"], // Resolve TypeScript and JavaScript files
            },
            module: {
                rules: [
                    {
                        test: /.ts$/,
                        use: "ts-loader",
                        exclude: /node_modules/,
                    },
                ],
            },
            node: {
                        __dirname: false, // For proper directory handling in Node.js
                        __filename: false,
            },
      };

I have tried a number of things from completely uninstalling the package, removing all packages, clearing the npm cache. Whats weird is the package seems to be up to date with the latest version of node.js as well as the m2 mac. Im wondering if I need to install a sub package for mac m2?

Any help would be greatly appreciated as this is a big hang up on my project.

New contributor

Niko Icardo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật