Dfx deploy failed

Hello everyone,
I try to achieve the Quick Start in local development but there are some errors which I don’t understand.

I had launch dfx start which is running on one window. On another I tap dfx deploy but at the middle of process I have this message :
" The post-build step failed for canister ‘ryjl3-tyaaa-aaaaa-aaaba-cai’ with an embedded error: The command ‘“npm” “run” “build”’ failed with exit status ‘exit code: 1’.

Stdout:

hello_assets@0.1.0 build

webpack
"

I have npm, but apparently my console doesn’t know “run” and “build”…

Furthermore, when I try dfx canister call hello greet everyone I have :
"The Replica returned an error: code 3, message: “Attempt to execute a message on canister rrkah-fqaaa-aaaaa-aaaaq-cai which contains no Wasm module”.

I have download wasm3 with brew install and error persist.

I haven’t find answer on this forum so I put here, but if this topic is already solved I can erase :slight_smile:

Try running npm install in the project directory first, see if that resolves it.

1 Like

I have done but problem persist

When I try run it says
“Input file not found : ‘Runfile’ : Please create the file or specify an alternative”.

Logic I haven’t specified any and I don’t know what file use run

You might try the following:
dfx stop (if you haven’t already done that)
rm -rf .dfx (to remove the .dfx directory from your project directory)
dfx start —clean
npm install
dfx deploy

You don’t need to use the npm build or run commands directly.
HTH

5 Likes

Thank you I will try

Is it normal dfx start --clean has launch :
"May 15 17:46:49.281 INFO ic-starter. Configuration: ValidatedConfig … May 15 17:46:51.666 WARN s:fscpm-uiaaa-aaaaa-aaaap-yai/n:wllx2-nstc6-mnfju-dii5p-fjosw-bautj-sqrnt-yfbje-aoqbd-l3ux2-wqe/ic_http_handler/ic_http_handler NNS subnet not found in network topology. Skipping fetching the delegation.

Starting webserver on port 52457 for replica at “http://localhost:52457

binding to: V4(127.0.0.1:8000)

replica(s): http://localhost:52457/" ?

Yes, you’ll see continuous output in the terminal running dfx start. You can run all other commands in a second terminal.

2 Likes

I really don’t understand :sweat_smile:.

I remove all folders, I have done each tips to download all again and I have always this after dfx start in a window and dfx deploy in another :
result of dfx deploy
"dfx deploy
Deploying all canisters.
Creating canisters…
Creating canister “hello”…
Creating the canister using the wallet canister…
Creating a wallet canister on the local network.
The wallet canister on the “local” network for user “default” is “rwlgt-iiaaa-aaaaa-aaaaa-cai”
“hello” canister created with canister id: “rrkah-fqaaa-aaaaa-aaaaq-cai”
Creating canister “hello_assets”…
Creating the canister using the wallet canister…
“hello_assets” canister created with canister id: “ryjl3-tyaaa-aaaaa-aaaba-cai”
Building canisters…
Building frontend…
The post-build step failed for canister ‘ryjl3-tyaaa-aaaaa-aaaba-cai’ with an embedded error: The command ‘“npm” “run” “build”’ failed with exit status ‘exit code: 1’.
Stdout:

hello_assets@0.1.0 build
webpack

Stderr:
/Users/galoisfield/ic-project/hello/node_modules/terser-webpack-plugin/dist/index.js:607
const hooks = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
^

TypeError: Cannot read property ‘javascript’ of undefined
at /Users/galoisfield/ic-project/hello/node_modules/terser-webpack-plugin/dist/index.js:607:38
at SyncHook.eval [as call] (eval at create…
at Object. (/Users/galoisfield/ic-project/hello/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (node:internal/modules/cjs/loader:1109:14)".

I don’t understand the error message and I try all recommendations.

But thank you very much for your comment, maybe I will find something randomly :grinning_face_with_smiling_eyes:

Does a brand new project created by dfx new hello deploy successfully?

What’s your version of npm (and maybe dfx to be sure). And what OS are you using?

No I tried and I have the previous message.

npm : 7.11.2
dfx : dfx 0.6.26

And MacOS the last

I really don’t understand why this commands failed

I tried dfx build too but it’s the same.

Might be a red herring, but my machine (Ubuntu 20.04) reports
npm 6.14.4 and node v10.19.0.

Maybe try dfx new --no-frontend <projname> to see if you can at least create and build a pure Motoko project without a frontend.

Hopefully some Mac user can chime in with what works for them.

3 Likes

Okay here it’s right :grin:
" dfx deploy

Deploying all canisters.

Creating canisters…

Creating canister “hello2”…

Creating the canister using the wallet canister…

Creating a wallet canister on the local network.

The wallet canister on the “local” network for user “default” is “rwlgt-iiaaa-aaaaa-aaaaa-cai”

“hello2” canister created with canister id: “rrkah-fqaaa-aaaaa-aaaaq-cai”

Creating canister “hello2_assets”…

Creating the canister using the wallet canister…

“hello2_assets” canister created with canister id: “ryjl3-tyaaa-aaaaa-aaaba-cai”

Building canisters…

Installing canisters…

Installing code for canister hello2, with canister_id rrkah-fqaaa-aaaaa-aaaaq-cai

Installing code for canister hello2_assets, with canister_id ryjl3-tyaaa-aaaaa-aaaba-cai

Authorizing our identity (default) to the asset canister…

Uploading assets to asset canister…

Deployed canisters."
:clap:

The npm run build step is just running the command “webpack” which is what’s failing (as your posts above show). This is only used in the frontend part of the project.

(“build” is a script entry in your project’s package.json file if you want to look).

It might be worth trying another version of npm and node to see if this fixes it, something does appear to be incompatible there.

You could use nvm to manage node versions more easily.

2 Likes

I have the same issue… same npm and dfx version, always fails at webpack with

TypeError: Cannot read property ‘javascript’ of undefined

Anyone has solved this issue?

btw, I’m also on macos with M1 chip, could it be related? I struggled with some other libraries (not dfinity related) to build successfully

Not an npm expert but did you do ‘npm install’ (perhaps after ‘npm update’ )

yes, unfortunately it didn’t help