# Dfx deploy locally with a new Dfx identity

**URL:** <https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470>\
**Category:** Command Line Tools\
**Created:** [November 9, 2022, 8:24pm UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470 "2022-11-09T20:24:50Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![FELIX](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/felix/32/8166_2.png) [@FELIX](https://forum.dfinity.org/u/FELIX)\
**Post date:** [January 12, 2023, 8:44pm UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/21 "2023-01-12T20:44:59Z")

</div>

Hi, same for me, deploy works with default but not with id created

with id it block like that

> Citation  
> Please enter the passphrase for your identity: [hidden]  
> Decryption complete.  
> Deploying all canisters.  
> All canisters have already been created.  
> Building canisters…  
> Shrink WASM module size.  
> Building frontend…  
> ^C

and default

> Citation  
> Deploying all canisters.  
> All canisters have already been created.  
> Building canisters…  
> Shrink WASM module size.  
> Building frontend…  
> WARN: Building canisters before generate for Motoko  
> Shrink WASM module size.  
> Generating type declarations for canister wawa\_backend:  
> src/declarations/wawa\_backend/wawa\_backend.did.d.ts  
> src/declarations/wawa\_backend/wawa\_backend.did.js  
> src/declarations/wawa\_backend/wawa\_backend.did

Installing canisters…  
Module hash 82dd0d3281e70992b8566e2c9da5a28452f2a4e7ca50593c1756260e66104a44 is already installed.  
Module hash db07e7e24f6f8ddf53c33a610713259a7c1eb71c270b819ebd311e2d223267f0 is already installed.  
Uploading assets to asset canister…  
Starting batch.  
Staging contents of new and changed assets:  
/index.html (689 bytes) sha 64e1989943da68e767ff91e8e4f453973f4cbaab2c250f2000fabb490466cd2a is already installed  
/index.html (gzip) (385 bytes) sha 2a3a6332dab58060c588eacf18fcbfe325380dc6a2d4b2a4c8d35a66996cd744 is already installed  
/index.js (637147 bytes) sha f8253daec6d00e00afe8a4667a8fe0656f4632bbff3380d84aaad6fac44ab38d is already installed  
/index.js (gzip) (152950 bytes) sha b82e991d40bbcf67279cce0607cf8feb5bcd67e088c36b21b9663a97f56a711d is already installed  
/favicon.ico (15406 bytes) sha 4e8d31b50ffb59695389d94e393d299c5693405a12f6ccd08c31bcf9b58db2d4 is already installed  
/index.js.map (681314 bytes) sha 48d0c7d17c9a9298421af42ca5226c53fa28b8a26de4e5ac74caebfcd0b02d47 is already installed  
/index.js.map (gzip) (156606 bytes) sha 2a5b095dd02f84c92e6972bd7ce60e7a631b993bf092c81a71846a593d875b3d is already installed  
/main.css (537 bytes) sha 75ac0c5aea719bb2b887fffbde61867be5c3a9eceab3d75619763c28735891cb is already installed  
/main.css (gzip) (299 bytes) sha b4879e7ba34e68b2965d626e48d772ce615e4f6b78b69cc8f2f91127ed18b850 is already installed  
/sample-asset.txt (24 bytes) sha 2d523f5aaeb195da24dcff49b0d560a3d61b8af859cee78f4cff0428963929e6 is already installed  
/logo2.svg (15139 bytes) sha 037eb7ae523403daa588cf4f47a34c56a3f5de08a5a2dd2364839e45f14f4b8b is already installed  
Committing batch.  
Deployed canisters.  
URLs:  
Frontend canister via browser

---

<div class="post-metadata">

**Author:** ![nolyoi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/nolyoi/32/8795_2.png) [@nolyoi](https://forum.dfinity.org/u/nolyoi)\
**Post date:** [January 13, 2023, 7:50am UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/23 "2023-01-13T07:50:12Z")

</div>

> [@FELIX](#):
>
> Hi, same for me, deploy works with default but not with id created

> [@ShueiYang](#):
>
> ow i thought i was the only one with this weird issue but looks like it’s not

in your package.json, remove the “prebuild” script, that worked for me.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [January 13, 2023, 8:20am UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/24 "2023-01-13T08:20:30Z")

</div>

I assume that this is the problem you guys are running into: [`dfx deploy` halts when running `npm run generate` using a protected identity · Issue #2872 · dfinity/sdk · GitHub](https://github.com/dfinity/sdk/issues/2872)

Looks like my comment above was wrong:

> [@Vivienne](#):
>
> The build step does not access your identity in any way

It should be `The build step SHOULD not access your identity in any way`.

Workaround that I can offer right now, which I figured out because of @nolyoi’s suggestion to remove the prebuild step:

- edit `package.json`
- find field `scripts.generate`
- replace `dfx generate <some canister name>` with `dfx --identity anonymous generate <some canister name>`

This will use the anonymous identity for the build step, (which is available to anyone and not protected by a password) and therefore will not hang the process.

---

<div class="post-metadata">

**Author:** ![FELIX](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/felix/32/8166_2.png) [@FELIX](https://forum.dfinity.org/u/FELIX)\
**Post date:** [January 13, 2023, 3:07pm UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/25 "2023-01-13T15:07:10Z")

</div>

thanks for the help, i ve tried to remove that

> “prebuild”: “npm run generate”,

dfx deply done that

Deploying all canisters.  
All canisters have already been created.  
Building canisters…  
Shrink WASM module size.  
Building frontend…  
Installing canisters…  
Module hash 82dd0d3281e70992b8566e2c9da5a28452f2a4e7ca50593c1756260e66104a44 is already installed.  
Module hash db07e7e24f6f8ddf53c33a610713259a7c1eb71c270b819ebd311e2d223267f0 is already installed.  
Uploading assets to asset canister…  
Starting batch.  
Error: Failed while trying to deploy canisters.  
Caused by: Failed while trying to deploy canisters.  
Failed while trying to install all canisters.  
Failed to install wasm module to canister ‘wawa\_frontend’.  
Failed to store assets in canister ‘wawa\_frontend’.  
Failed asset sync with canister xxxxxx-jaaaa-aaaaa-xxxxxxx-cai.  
The Replica returned an error: code 4, message: “Caller is not authorized”

---

<div class="post-metadata">

**Author:** ![FELIX](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/felix/32/8166_2.png) [@FELIX](https://forum.dfinity.org/u/FELIX)\
**Post date:** [January 13, 2023, 3:15pm UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/26 "2023-01-13T15:15:40Z")

</div>

Thanks, i ve tried too your solution, it done that

Deploying all canisters.  
All canisters have already been created.  
Building canisters…  
Shrink WASM module size.  
Building frontend…  
WARN: Building canisters before generate for Motoko  
Shrink WASM module size.  
Generating type declarations for canister wawa\_backend:  
src/declarations/wawa\_backend/wawa\_backend.did.d.ts  
src/declarations/wawa\_backend/wawa\_backend.did.js  
src/declarations/wawa\_backend/wawa\_backend.did

Installing canisters…  
Module hash 82dd0d3281e70992b8566e2c9da5a28452f2a4e7ca50593c1756260e66104a44 is already installed.  
Module hash db07e7e24f6f8ddf53c33a610713259a7c1eb71c270b819ebd311e2d223267f0 is already installed.  
Uploading assets to asset canister…  
Starting batch.  
Error: Failed while trying to deploy canisters.  
Caused by: Failed while trying to deploy canisters.  
Failed while trying to install all canisters.  
Failed to install wasm module to canister ‘wawa\_frontend’.  
Failed to store assets in canister ‘wawa\_frontend’.  
Failed asset sync with canister xxxxxxxx-jaaaa-aaaaa-xxxxxxx-cai.  
The Replica returned an error: code 4, message: “Caller is not authorized”

it s done the same

---

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [January 14, 2023, 9:42am UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/27 "2023-01-14T09:42:15Z")

</div>

Another workaround is to use an identity without encryption til this issue is fixed.

dfx identity new xxx **–disable-encryption**

---

<div class="post-metadata">

**Author:** ![ShueiYang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/shueiyang/32/8061_2.png) [@ShueiYang](https://forum.dfinity.org/u/ShueiYang)\
**Post date:** [January 14, 2023, 10:40pm UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/28 "2023-01-14T22:40:50Z")

</div>

@rbole yea we know, this is what i told when I post the first time, btw the solution nolyoi provide work for me when I remove the “prebuild” script, also the solution from Severin work as well if i change the script to :

> “generate”: “dfx --identity anonymous generate `<some canister name>`”

@FELIX Did you try to remove all your canister and clean up using the cmd line :

> rm -rf ./.dfx/\* canisters/\*

then try to redeploy again after updating the script in package.json ?

---

<div class="post-metadata">

**Author:** ![FranHefner](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/franhefner/32/7772_2.png) [@FranHefner](https://forum.dfinity.org/u/FranHefner)\
**Post date:** [January 18, 2023, 2:10am UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/29 "2023-01-18T02:10:23Z")

</div>

To save time, I solved it like this.

- Export my identity & remember the ids of your canisters // wallet // backup proyects

> **[Highlights of what’s new in 0.10.0 | Internet Computer Home](https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/0.10.0-rn#new-feature-identity-export)**
>
> An overview of the 0.10.0 release:

- Delete all the wsl with the distributions (in my case I use W11 with wsl)

- Install ubuntu again and update it ( sudo apt update & sudo apt full-upgrade )

- Install dfx

- Import Identity

- Set of the previous canisters ( dfx identity set-wallet “id” --network ic)

Everything working again.

---

<div class="post-metadata">

**Author:** ![FranHefner](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/franhefner/32/7772_2.png) [@FranHefner](https://forum.dfinity.org/u/FranHefner)\
**Post date:** [January 18, 2023, 2:43pm UTC](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470/30 "2023-01-18T14:43:39Z")

</div>

As an extra value to the analysis they did, I can say that this inconvenience does not “break” the process, but rather that it continues (perhaps it enters an infinite loop or similar). I discovered this with the top command, visualizing that the process continues to constantly consume resources.

[Previous page](https://forum.dfinity.org/t/dfx-deploy-locally-with-a-new-dfx-identity/16470.md?page=1)
