Errors when dfx build with the Linkedup tutorial

Environment:
OS: macOS Mojave 10.14.6
Node: v14.15.4
npm: 7.20.0

When I follow this tutorial, everything goes well until the “dfx build” step.

The terminal says"

dfx build
Building canisters…
Building frontend…
The post-build step failed for canister ‘r7inp-6aaaa-aaaaa-aaabq-cai’ with an embedded error: The command ‘“npm” “run” “build”’ failed with exit status ‘exit code: 2’.
Stdout:

[email protected] build
webpack

Hash: 376e8d59cb68aaa0cccb
Version: webpack 4.44.1
Child
Hash: 376e8d59cb68aaa0cccb
Time: 3852ms
Built at: 2021/08/07 下午2:28:30
3 assets
Entrypoint main = index.js index.js.map
[8] (webpack)/buildin/global.js 472 bytes {0} [built]
[13] ./src/linkedup/public/index.css 573 bytes {0} [built]
[14] ./node_modules/css-loader/dist/cjs.js!./src/linkedup/public/index.css 16.2 KiB {0} [built]
[15] ./src/linkedup/public/main.js + 2 modules 10.9 KiB {0} [built]
| ./src/linkedup/public/main.js 7.44 KiB [built]
| ./src/linkedup/public/templates.js 3.11 KiB [built]
| ./src/linkedup/public/utils.js 267 bytes [built]
+ 12 hidden modules

ERROR in ./src/linkedup/public/main.js
Module not found: Error: Can't resolve 'ic:canisters/linkedup' in '/Users/lilfat/Desktop/Github/dfx_test/local/Make_inter-canister_calls/linkedup/src/linkedup/public'
 @ ./src/linkedup/public/main.js 7:0-45 102:32-40 103:31-39 106:37-45 119:29-37 125:14-22 126:14-22 145:27-35 156:34-42 170:24-32 172:20-28 173:20-28 199:16-24 256:10-18

ERROR in ./src/linkedup/public/main.js
Module not found: Error: Can't resolve 'ic:canisters/linkedup_assets' in '/Users/lilfat/Desktop/Github/dfx_test/local/Make_inter-canister_calls/linkedup/src/linkedup/public'
 @ ./src/linkedup/public/main.js 8:0-59 23:0-15

Stderr:
"

1 Like

Have someone met this problem before?
Thank you guys!

When I follow this tutorial:
Make inter-canister calls :: Internet Computer
, everything goes well until the “dfx build” step.
(I followed every step including npm install and npm audit fix ).

Environment:
OS: macOS Mojave 10.14.6
Node: v14.15.4
npm: 7.20.0
dfx:0.8.0

It looks like its been a while since there was a commit in the Linkedup example. Maybe you are facing such issue because you are using a more recent version of dfx?

They used v0.6.22 and you are using last one v0.8.0

Since I changed the dfx.json file, so the dfx version should not corrupt this program.
But I do not know the details about the difference between 0.6.22 and 0.8.0, so I am not sure about that.

There were some breaking changes between 0.7.7 and 0.8.0 so I can imagine from 0.6.22 there was some too which might leads to the issue.

But, again, only my guessing.

0.7.7 → 0.8.0

all changelogs

For anyone still trying to build linkedup: stop dfx, uninstall dfx, and then install dfx v0.6.22 before proceeding…