dfinity / cdk-rs

Rust canister development kit for the Internet Computer.
Apache License 2.0
200 stars 85 forks source link

Error: Failed while trying to deploy canisters. #353

Open uouaks opened 1 year ago

uouaks commented 1 year ago

Help. I can't start the project Chess

[~/cdk-rs/examples/chess]
└─$ dfx deploy            
Deploying all canisters.
All canisters have already been created.
Building canisters...
Executing 'sh ../build.sh chess chess_rs'
    Finished release [optimized] target(s) in 0.87s
../build.sh: 15: ic-wasm: not found
Building frontend...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed to build call canisters.
    Failed while trying to build all canisters.
      The build step failed for canister 'rkp4c-7iaaa-aaaaa-aaaca-cai' (chess_rs) with an embedded error: Failed to build custom canister chess_rs.: Failed to run sh ../build.sh chess chess_rs.: The custom tool failed.
~/cdk-rs/examples/chess]
└─$ npm start             

> new_project@0.1.0 start
> webpack serve --mode development --env development

No production canister_ids.json found. Continuing with local
[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.                         
 - options has an unknown property 'watchContentBase'. These properties are valid:                                                                        
   object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? } 
sesi200 commented 1 year ago

I can't reproduce anything that can't be fixed with npm install. I can, however, see that ic-wasm is required to build the backend properly. Do you have that installed?

uouaks commented 1 year ago

You're right! I have not installed ic-wasm The next step and now I see such errors.

[~/cdk-rs/examples/chess]
└─$ dfx deploy           
Deploying all canisters.
All canisters have already been created.
Building canisters...
Executing 'sh ../build.sh chess chess_rs'
    Finished release [optimized] target(s) in 1.18s
Building frontend...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed to build call canisters.
    Failed while trying to build all canisters.
      The post-build step failed for canister 'rno2w-sqaaa-aaaaa-aaacq-cai' (chess_rs_assets) with an embedded error: Failed to build frontend for network 'local'.: The command '"npm" "run" "build"' failed with exit status 'exit status: 2'.
Stdout:

> new_project@0.1.0 build
> webpack

No production canister_ids.json found. Continuing with local

Stderr:
[webpack-cli] Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at BulkUpdateDecorator.hashFactory (/home/kali/cdk-rs/examples/chess/node_modules/webpack/lib/util/createHash.js:155:18)
    at BulkUpdateDecorator.digest (/home/kali/cdk-rs/examples/chess/node_modules/webpack/lib/util/createHash.js:80:21)
    at /home/kali/cdk-rs/examples/chess/node_modules/webpack/lib/DefinePlugin.js:595:38
    at Hook.eval [as call] (eval at create (/home/kali/cdk-rs/examples/chess/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
    at Hook.CALL_DELEGATE [as _call] (/home/kali/cdk-rs/examples/chess/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/home/kali/cdk-rs/examples/chess/node_modules/webpack/lib/Compiler.js:1053:26)
    at /home/kali/cdk-rs/examples/chess/node_modules/webpack/lib/Compiler.js:1097:29
    at Hook.eval [as callAsync] (eval at create (/home/kali/cdk-rs/examples/chess/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
sesi200 commented 1 year ago

Which version of node are you running? I'm on 19.2 right now and don't see any issues. Recently, 16 and 18 were most stable for IC development.

uouaks commented 1 year ago

Followed your advice installed and nvm use 16. Chess app didn't deploy.

[~/cdk-rs/examples/chess]
└─$ node -v                      
v16.19.0

~/cdk-rs/examples/chess]
└─$ dfx deploy
Deploying all canisters.
All canisters have already been created.
Building canisters...
Executing 'sh ../build.sh chess chess_rs'
    Finished release [optimized] target(s) in 0.11s
Building frontend...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed to build call canisters.
    Failed while trying to build all canisters.
      The post-build step failed for canister 'rno2w-sqaaa-aaaaa-aaacq-cai' (chess_rs_assets) with an embedded error: Failed to build frontend for network 'local'.: The command '"npm" "run" "build"' failed with exit status 'exit status: 1'.
Stdout:

> new_project@0.1.0 build
> webpack

No production canister_ids.json found. Continuing with local
asset index.js 1.77 MiB [compared for emit] (name: index) 1 related asset
asset index.html 185 bytes [compared for emit]
runtime modules 1.16 KiB 6 modules
modules by path ./node_modules/ 1.67 MiB 70 modules
modules by path ./src/ 15.1 KiB
  modules by path ./src/chess_rs_assets/ 13.6 KiB
    modules by path ./src/chess_rs_assets/*.tsx 11.8 KiB
      ./src/chess_rs_assets/index.tsx 517 bytes [built] [code generated]
      ./src/chess_rs_assets/chess.tsx 1.64 KiB [built] [code generated]
      ./src/chess_rs_assets/integration.tsx 9.63 KiB [built] [code generated]
    modules by path ./src/chess_rs_assets/*.css 1.87 KiB
      ./src/chess_rs_assets/index.css 1.14 KiB [built] [code generated]
      ./node_modules/css-loader/dist/cjs.js!./src/chess_rs_assets/index.css 747 bytes [built] [code generated]
  modules by path ./src/declarations/chess_rs/*.js 1.49 KiB
    ./src/declarations/chess_rs/index.js 1.15 KiB [built] [code generated]
    ./src/declarations/chess_rs/chess_rs.did.js 348 bytes [built] [code generated]

ERROR in /home/kali/node_modules/webpack/types.d.ts
1495:2-5
[tsl] ERROR in /home/kali/node_modules/webpack/types.d.ts(1495,3)
      TS1131: Property or signature expected.

ERROR in /home/kali/node_modules/webpack/types.d.ts
1496:2-3
[tsl] ERROR in /home/kali/node_modules/webpack/types.d.ts(1496,3)
      TS1109: Expression expected.

ERROR in /home/kali/node_modules/webpack/types.d.ts
1504:54-55
[tsl] ERROR in /home/kali/node_modules/webpack/types.d.ts(1504,55)
      TS1005: '(' expected.

ERROR in /home/kali/node_modules/webpack/types.d.ts
1543:25
[tsl] ERROR in /home/kali/node_modules/webpack/types.d.ts(1543,26)
      TS1011: An element access expression should take an argument.

ERROR in /home/kali/cdk-rs/examples/chess/node_modules/@types/express-serve-static-core/index.d.ts
1255:0
[tsl] ERROR in /home/kali/cdk-rs/examples/chess/node_modules/@types/express-serve-static-core/index.d.ts(1255,1)
      TS1160: Unterminated template literal.

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

webpack 5.56.1 compiled with 407 errors in 30453 ms

Stderr:
sesi200 commented 1 year ago

This looks like something's wrong with your webpack installation. Have you tried nuking node_modules? I just tried again with both node 16 and 18 and it worked with both verisons.

I also noticed that your log shows webpack 5.56.1 whereas package.json contains an older version. Did you maybe update to incompatible versions?