Deploy failed NPM Error

deudaexpress@Deudas-Mac-mini dblogs % dfx deploy
Deploying all canisters.
All canisters have already been created.
Building canisters…
WARN: /Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/dblogs_backend/ warning [M0194], unused identifier dblogs (delete or rename to wildcard _ or _dblogs)

Building frontend…
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed to build all canisters.
Failed while trying to build all canisters.
The post-build step failed for canister ‘dzh22-nuaaa-aaaaa-qaaoa-cai’ (dblogs_frontend) with an embedded error: Failed to build frontend for network ‘local’.: The command ‘cd “/Users/deudaexpress/Desktop/udemy/Web 3/dblogs” && CANISTER_CANDID_PATH=“/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/.dfx/local/canisters/dblogs_frontend/assetstorage.did” CANISTER_CANDID_PATH_DBLOGS_BACKEND=“/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/.dfx/local/canisters/dblogs_backend/dblogs_backend.did” CANISTER_ID=“dzh22-nuaaa-aaaaa-qaaoa-cai” CANISTER_ID_DBLOGS_BACKEND=“dmalx-m4aaa-aaaaa-qaanq-cai” CANISTER_ID_DBLOGS_FRONTEND=“dzh22-nuaaa-aaaaa-qaaoa-cai” CANISTER_ID_INTERNET_IDENTITY=“d6g4o-amaaa-aaaaa-qaaoq-cai” DFX_NETWORK=“local” DFX_VERSION=“0.18.0” “npm” “run” “build” “–workspace” “dblogs_frontend”’ failed with exit status ‘exit status: 1’.

dblogs_frontend@0.0.0 prebuild
dfx generate

dblogs_frontend@0.0.0 build
tsc && vite build

Building canisters before generate for Motoko
WARN: /Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/dblogs_backend/ warning [M0194], unused identifier dblogs (delete or rename to wildcard _ or _dblogs)

Generating type declarations for canister internet_identity:
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/internet_identity/internet_identity.did.d.ts
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/internet_identity/internet_identity.did.js
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/internet_identity/internet_identity.did
Generating type declarations for canister dblogs_frontend:
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/dblogs_frontend/dblogs_frontend.did.d.ts
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/dblogs_frontend/dblogs_frontend.did.js
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/dblogs_frontend/dblogs_frontend.did
Generating type declarations for canister dblogs_backend:
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/dblogs_backend/dblogs_backend.did.d.ts
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/dblogs_backend/dblogs_backend.did.js
/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/declarations/dblogs_backend/dblogs_backend.did
failed to load config from /Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/dblogs_frontend/vite.config.js
error during build:
You installed esbuild for another platform than the one you’re currently using.
This won’t work because esbuild is written with native code and needs to
install a platform-specific binary executable.

Specifically the “@esbuild/darwin-arm64” package is present but this platform
needs the “@esbuild/darwin-x64” package instead. People often get into this
situation by installing esbuild with npm running inside of Rosetta 2 and then
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
2 is Apple’s on-the-fly x86_64-to-arm64 translation service).

If you are installing with npm, you can try ensuring that both npm and node are
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
changing how you installed npm and/or node. For example, installing node with
the universal installer here should work: Node.js — Download Node.js®. Or
you could consider using yarn instead of npm which has built-in support for
installing a package on multiple platforms simultaneously.

If you are installing with yarn, you can try listing both “arm64” and “x64”
in your “.yarnrc.yml” file using the “supportedArchitectures” feature:

Keep in mind that this means multiple copies of esbuild will be present.

Another alternative is to use the “esbuild-wasm” package instead, which works
the same way on all platforms. But it comes with a heavy performance cost and
can sometimes be 10x slower than the “esbuild” package, so you may also not
want to do that.

at generateBinPath (/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/node_modules/esbuild/lib/main.js:1888:17)
at esbuildCommandAndArgs (/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/node_modules/esbuild/lib/main.js:1969:33)
at ensureServiceIsRunning (/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/node_modules/esbuild/lib/main.js:2133:25)
at build (/Users/deudaexpress/Desktop/udemy/Web 3/dblogs/node_modules/esbuild/lib/main.js:2025:26)
at bundleConfigFile (file:///Users/deudaexpress/Desktop/udemy/Web%203/dblogs/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:66209:26)
at loadConfigFromFile (file:///Users/deudaexpress/Desktop/udemy/Web%203/dblogs/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:66185:31)
at resolveConfig (file:///Users/deudaexpress/Desktop/udemy/Web%203/dblogs/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:65782:34)
at build (file:///Users/deudaexpress/Desktop/udemy/Web%203/dblogs/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:47926:26)
at CAC.<anonymous> (file:///Users/deudaexpress/Desktop/udemy/Web%203/dblogs/node_modules/vite/dist/node/cli.js:842:15)

npm ERR! Lifecycle script build failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: dblogs_frontend@0.0.0
npm ERR! at location: /Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/dblogs_frontend

1 Like

Does this not help your issue? seems like this might be running on an Apple arm chip?

1 Like

Thanks for reply yes I tried but it didnt worked

1 Like

I’ve been encountering this occasionally too - particularly with CI. Try:

rm -rf node_modules
rm package-lock.json
npm install

And you might want to do npm update for good measure

1 Like

Thanks for the reply I tried your suggestions but the problem remains the same.

1 Like

I can’t really do anything further to troubleshoot with what you’ve shared


let me explain the error occured when i pulled my github repository then after that the error is started