Solve the Cannot read property hash of undefined error

After I update the next.js from the version 6.1.2 to the newest version at the time 7.0 I run yarn build to do the compilation and this is what I had as an errors:

[hardsource:efb84745] Could not freeze ./lib/queries.js: Cannot read property 'hash' of undefined
[hardsource:efb84745] Could not freeze ./pages/signin.js + 1 modules: Cannot read property 'hash' of undefined
[hardsource:efb84745] Could not freeze ./pages/create-account.js + 2 modules: Cannot read property 'hash' of undefined
[hardsource:efb84745] Could not freeze ./pages/activate-account.js + 1 modules: Cannot read property 'hash' of undefined
[hardsource:efb84745] Could not freeze ./pages/reset-password.js + 1 modules: Cannot read property 'hash' of undefined
[hardsource:efb84745] Could not freeze ./pages/reset-password-confirmation.js + 1 modules: Cannot read property 'hash' of undefined

To solve this problem I remove the hard-source folder from /node_modules/.cache/hard-source/ and I rerun yarn build again.

yarn build
yarn run v1.9.4
$ next build
[hardsource:8c7e1fbc] Using 7 MB of disk space.
[hardsource:8c7e1fbc] Tracking node dependencies with: package-lock.json, yarn.lock.
[hardsource:8c7e1fbc] Reading from cache 8c7e1fbc...
[hardsource:efb84745] Using 7 MB of disk space.
[11:57:22 AM] Compiling client
[hardsource:efb84745] Tracking node dependencies with: package-lock.json, yarn.lock.
[hardsource:efb84745] Reading from cache efb84745...
[11:57:49 AM] Compiling server
[11:57:50 AM] Compiled client in 28s
[11:57:50 AM] Compiled server in 662ms
✨  Done in 34.11s.