# Deploy failed NPM Error

**URL:** <https://forum.dfinity.org/t/deploy-failed-npm-error/29045>\
**Category:** Developers\
**Tags:** Functional-Programming, candid, Discussing, deployed\
**Created:** [March 28, 2024, 7:00pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045 "2024-03-28T19:00:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulaauji-30](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rahulaauji-30/32/10179_2.png) [@rahulaauji-30](https://forum.dfinity.org/u/rahulaauji-30)\
**Post date:** [March 28, 2024, 7:00pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/1 "2024-03-28T19:00:53Z")

</div>

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/main.mo:4.7-4.13: 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’.  
Stdout:

> dblogs\_frontend@0.0.0 prebuild  
> dfx generate

> dblogs\_frontend@0.0.0 build  
> tsc && vite build

Stderr:  
Building canisters before generate for Motoko  
WARN: /Users/deudaexpress/Desktop/udemy/Web 3/dblogs/src/dblogs\_backend/main.mo:4.7-4.13: 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:  
Error:  
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®](https://nodejs.org/en/download/). 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:

> **[Settings (.yarnrc.yml) | Yarn](https://yarnpkg.com/configuration/yarnrc)**
>
> Allowed fields in .yarnrc.yml files

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

---

<div class="post-metadata">

**Author:** ![Gekctek](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gekctek/32/6863_2.png) [@Gekctek](https://forum.dfinity.org/u/Gekctek)\
**Post date:** [March 28, 2024, 10:34pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/2 "2024-03-28T22:34:16Z")

</div>

> [@rahulaauji-30](#):
>
> 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®](https://nodejs.org/en/download/). Or  
> you could consider using yarn instead of npm which has built-in support for  
> installing a package on multiple platforms simultaneously.

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

---

<div class="post-metadata">

**Author:** ![rahulaauji-30](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rahulaauji-30/32/10179_2.png) [@rahulaauji-30](https://forum.dfinity.org/u/rahulaauji-30)\
**Post date:** [March 29, 2024, 8:50am UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/3 "2024-03-29T08:50:30Z")

</div>

Thanks for reply yes I tried but it didnt worked

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [March 29, 2024, 4:41pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/4 "2024-03-29T16:41:21Z")

</div>

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

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

```

And you might want to do `npm update` for good measure

---

<div class="post-metadata">

**Author:** ![rahulaauji-30](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rahulaauji-30/32/10179_2.png) [@rahulaauji-30](https://forum.dfinity.org/u/rahulaauji-30)\
**Post date:** [April 6, 2024, 5:30pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/5 "2024-04-06T17:30:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [April 8, 2024, 8:47pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/6 "2024-04-08T20:47:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rahulaauji-30](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rahulaauji-30/32/10179_2.png) [@rahulaauji-30](https://forum.dfinity.org/u/rahulaauji-30)\
**Post date:** [April 10, 2024, 12:19pm UTC](https://forum.dfinity.org/t/deploy-failed-npm-error/29045/7 "2024-04-10T12:19:06Z")

</div>

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