Deployment to IC error

When I deploy locally, the app works fine. When I try to deploy on the IC, I get an error, which costs me valuable ICP. Help before I become bankrupt!!!

blahblah@DESKTOP-LD764BH:~/ic-projects/dkeeper$ dfx deploy --network ic --with-cycles 1000000000000
Deploying all canisters.
Creating canisters…
Creating canister “dkeeper”…
“dkeeper” canister created on network “ic” with canister id: “5zuok-kqaaa-aaaal-ab5lq-cai”
Creating canister “dkeeper_assets”…
“dkeeper_assets” canister created on network “ic” with canister id: “4u2ke-fyaaa-aaaal-ab5ma-cai”
Building canisters…
Building frontend…
Error: The post-build step failed for canister ‘4u2ke-fyaaa-aaaal-ab5ma-cai’ with an embedded error: The command ‘“npm” “run” “build”’ failed with exit status ‘exit status: 1’.
Stdout:

dkeeper_assets@0.1.0 prebuild
npm run copy:types

dkeeper_assets@0.1.0 copy:types
rsync -avr .dfx/$(echo ${DFX_NETWORK:-‘'})/canisters/ --exclude=‘assets/’ --exclude=‘idl/’ --exclude=’*.wasm’ --delete src/declarations

sending incremental file list
deleting dkeeper/dkeeper.old.most
deleting dkeeper/dkeeper.old.did
dkeeper/
dkeeper/dkeeper.did
dkeeper/dkeeper.did.d.ts
dkeeper/dkeeper.did.js
dkeeper/dkeeper.most
dkeeper/index.js
dkeeper_assets/
dkeeper_assets/dkeeper_assets.did
dkeeper_assets/dkeeper_assets.did.d.ts
dkeeper_assets/dkeeper_assets.did.js
dkeeper_assets/index.js

sent 16,787 bytes received 250 bytes 34,074.00 bytes/sec
total size is 19,830 speedup is 1.16

dkeeper_assets@0.1.0 build
webpack

assets by status 484 KiB [cached] 6 assets
orphan modules 503 KiB [orphan] 157 modules
runtime modules 1.16 KiB 6 modules
cacheable modules 906 KiB
modules by path ./node_modules/@material-ui/ 166 KiB 11 modules
modules by path ./node_modules/@babel/runtime/helpers/ 5.45 KiB 10 modules
modules by path ./node_modules/borc/ 113 KiB 10 modules
modules by path ./node_modules/simple-cbor/src/*.js 17.5 KiB 3 modules
modules by path ./node_modules/hoist-non-react-statics/ 5.36 KiB 3 modules
modules by path ./node_modules/iso-url/ 4.36 KiB 3 modules
modules by path ./node_modules/react/ 6.7 KiB 2 modules
modules by path ./node_modules/react-dom/ 117 KiB 2 modules
modules by path ./node_modules/scheduler/ 5.12 KiB 2 modules

  • 10 modules

ERROR in Error: Parse Error: <link font-family: “Montserrat”, sans-serif;
href=“https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=s wap”
rel=“stylesheet” />

<body>
  <div id="root"></div>
  <script src="../src/index.js" type="text/jsx"></script>
</body>
  • htmlparser.js:255 HTMLParser.parse
    [dkeeper]/[html-minifier-terser]/src/htmlparser.js:255:15

  • task_queues:96 processTicksAndRejections
    node:internal/process/task_queues:96:5

  • htmlminifier.js:1282 async minify
    [dkeeper]/[html-minifier-terser]/src/htmlminifier.js:1282:3

  • htmlminifier.js:1365 async Object.exports.minify
    [dkeeper]/[html-minifier-terser]/src/htmlminifier.js:1365:16

webpack 5.69.1 compiled with 1 error in 15391 ms

Stderr:

1 Like

Hi, before you deploy the frontend canister to IC, you can run ‘npm run build’ to verify if your frontend can compile successfully.

1 Like

I’m also getting a similar error. Any help regarding this issue would be greatly appreciated:

Blockquote 1. ```
hello_assets@0.1.0 prestart
npm run copy:types

hello_assets@0.1.0 copy:types
rsync -avr .dfx/$(echo ${DFX_NETWORK:-‘'})/canisters/ --exclude=‘assets/’ --exclude=‘idl/’ --exclude=’*.wasm’ --delete src/declarations

Unexpected remote arg: $DFX_NETWORK:-)/canisters/
rsync error: syntax or usage error (code 1) at main.c(1508) [sender=3.2.7]

@Severin answered a similar question (I think) and pointed to this [answer]Dfx deploy locally with a new Dfx identity - #24 by Severin).

Can it be the answer here too?

When I run “npm run build”, I get the following. I also have 4 problems show up in my tsconfig.json file, which I show at the bottom of this reply.

blahblah@DESKTOP-LD764BH:~/ic-projects/dkeeper$ npm run build

dkeeper_assets@0.1.0 prebuild
npm run copy:types

dkeeper_assets@0.1.0 copy:types
rsync -avr .dfx/$(echo ${DFX_NETWORK:-‘'})/canisters/ --exclude=‘assets/’ --exclude=‘idl/’ --exclude=’*.wasm’ --delete src/declarations

sending incremental file list
dkeeper/
dkeeper/dkeeper.did
dkeeper/dkeeper.did.d.ts
dkeeper/dkeeper.did.js
dkeeper/dkeeper.most
dkeeper/dkeeper.old.did
dkeeper/dkeeper.old.most
dkeeper/index.js
dkeeper_assets/
dkeeper_assets/dkeeper_assets.did
dkeeper_assets/dkeeper_assets.did.d.ts
dkeeper_assets/dkeeper_assets.did.js
dkeeper_assets/index.js

sent 17,527 bytes received 233 bytes 35,520.00 bytes/sec
total size is 39,991 speedup is 2.25

dkeeper_assets@0.1.0 build
webpack

asset index.js 1.91 MiB [compared for emit] (name: index) 1 related asset
asset logo.png 24.8 KiB [compared for emit] [from: src/dkeeper_assets/assets/logo.png] [copied]
asset favicon.ico 15 KiB [compared for emit] [from: src/dkeeper_assets/assets/favicon.ico] [copied]
asset styles.css 1.67 KiB [compared for emit] [from: src/dkeeper_assets/assets/styles.css] [copied]
asset index.html 584 bytes [compared for emit]
asset sample-asset.txt 24 bytes [compared for emit] [from: src/dkeeper_assets/assets/sample-asset.txt] [copied]
orphan modules 44.6 KiB [orphan] 37 modules
runtime modules 1.16 KiB 6 modules
modules by path ./node_modules/ 1.71 MiB 174 modules
modules by path ./src/ 5.64 KiB
modules by path ./src/dkeeper_assets/src/ 3.88 KiB
./src/dkeeper_assets/src/index.jsx 179 bytes [built] [code generated]
./src/dkeeper_assets/src/components/App.jsx 1.28 KiB [built] [code generated]
./src/dkeeper_assets/src/components/Header.jsx 297 bytes [built] [code generated]
./src/dkeeper_assets/src/components/Footer.jsx 256 bytes [built] [code generated]
./src/dkeeper_assets/src/components/Note.jsx 483 bytes [built] [code generated]
./src/dkeeper_assets/src/components/CreateArea.jsx 1.42 KiB [built] [code generated]
modules by path ./src/declarations/dkeeper/*.js 1.76 KiB
./src/declarations/dkeeper/index.js 1.39 KiB [built] [code generated]
./src/declarations/dkeeper/dkeeper.did.js 378 bytes [built] [code generated]
webpack 5.69.1 compiled successfully in 6638 ms
blahblah@DESKTOP-LD764BH:~/ic-projects/dkeeper$

The four problems in tsconfig.json file:

I looked it over and there are some parallels but I really don’t want to try everything on that post. I usually fall down a rabbit hole that is hard to get out of. I can deploy this project locally. Moreover, I’ve deployed other projects locally and on the IC. Only this project doesn’t go on the IC.

Maybe you can compare these projects that succeed with your project that does not work and find your issue?

Is you project configured to generate the did files with dfx generate?

What version of dfx is used in this project?

Sorry I cannot be really more precise because the issue finds place in your particular project. Not sure I will find time today but if your project is open source and provided with instructions, I can try to check it out and build it.

I’m using dfx 0.9.3. When I run “dfx generate”:
blah@DESKTOP-LD764BH:~/ic-projects/dkeeper$ dfx generate
Building canisters before generate for Motoko
Building frontend…
Generating type declarations for canister dkeeper_assets:
src/declarations/dkeeper_assets/dkeeper_assets.did.d.ts
src/declarations/dkeeper_assets/dkeeper_assets.did.js
src/declarations/dkeeper_assets/index.js
src/declarations/dkeeper_assets/dkeeper_assets.did
Generating type declarations for canister dkeeper:
src/declarations/dkeeper/dkeeper.did.d.ts
src/declarations/dkeeper/dkeeper.did.js
src/declarations/dkeeper/index.js
src/declarations/dkeeper/dkeeper.did

You can find my project here. The project allows a user to make notes and delete them. Good luck on building it!

Oh that’s outtdated, that’s probably the reason why dfx generate does not work.

Are you stuck with the version or do you plan to upgrade?

I would like to stick with dfx 0.9.3. I tried upgrading before and everything got thrown off. So I went back to rebuilding the project as my instructor instructed.

I see, in that case I unfortunately can not really help more. I am using a newer version of dfx (note I’m not part that team, just using it as you do) and the generation of the declarations has changed which now uses dfx generate and which I think would solve the issue you are facing.

In your index.html change

    <link font-family: "Montserrat", sans-serif;
    href="https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=swap"
    rel="stylesheet" />

to

  <link href="https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=swap" rel="stylesheet" />