'Is there any way to skip hoisting during yarn build?

Recently I have updated the node version to 16+. Prior to that, I was able to trigger the yarn build command to create the build of my project.

But after installation of node 16+, the yarn build command is throwing the following errors

./lib/view-registration.js
Module not found: Error: Can't resolve 'hoisted/@msdyn365-commerce-modules/wishlist/dist/lib/modules/wishlist-items/wishlist-items.view.js' in 'H:\source\D365_eCommerce\lib'
 @ ./lib/view-registration.js 5:112769-113063
 @ ./node_modules/@msdyn365-commerce/bootloader/entry/client.js
 @ multi ./node_modules/@msdyn365-commerce/bootloader/entry/webpack-public-path.js ./node_modules/@msdyn365-commerce/bootloader/entry/client

It seems like it is trying to pick the module from the hoisted folder.

I am new to this concept so have no idea why it is targeting this folder in spite of this it should pick the module from '@msdyn365-commerce-modules/wishlist/dist/lib/modules/wishlist-items/wishlist-items.view.js' directly.

Any explanation would be appreciated.

How can I force it to not pick the module directly from the hoisted folder and use '@msdyn365-commerce-modules/wishlist/dist/lib/modules/wishlist-items/wishlist-items.view.js' directly

Thanks, Aman



Solution 1:[1]

This issue mainly occurred due to the corrupt version of Node. The only possible solution for this is to make sure that all the dependencies required for Node (16+) are also installed.

We can either download all the dependencies manually or just need to allow the node itself to download all the dependencies at the time of installation.

enter image description here

Thanks, Aman

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aman Soni