microsoft / Msdyn365.Commerce.Online

Dynamics 365 Commerce online project
Other
49 stars 41 forks source link

Error when run `yarn build` on macOS #37

Closed tbcan closed 2 years ago

tbcan commented 2 years ago

Hi,

I have a fatal error when running yarn build on macOS(Big Sur).

Current version:

OS: Big Sur(11.2.3)
Node: v12.22.7

Here is the error message:

Errors:
 > Error 1:
./node_modules/chokidar/node_modules/fsevents/fsevents.node 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
 @ ./node_modules/chokidar/node_modules/fsevents/fsevents.js 13:15-41
 @ ./node_modules/chokidar/lib/fsevents-handler.js
 @ ./node_modules/chokidar/index.js
 @ ./node_modules/watchpack/lib/chokidar.js
 @ ./node_modules/watchpack/lib/DirectoryWatcher.js
 @ ./node_modules/watchpack/lib/watcherManager.js
 @ ./node_modules/watchpack/lib/watchpack.js
 @ (webpack)/lib/node/NodeWatchFileSystem.js
 @ (webpack)/lib/node/NodeEnvironmentPlugin.js
 @ (webpack)/lib/webpack.js
 @ ./node_modules/@msdyn365-commerce/bootloader/entry/index.js
 @ multi ./node_modules/@msdyn365-commerce/bootloader/entry
Errors during webpack build. See previous several lines for additional messages (written as 'stats-server-build-errors.json').
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Do I miss anything?

Regards. Can

tbcan commented 2 years ago
  1. Run the following command

    yarn config set ignore-optional true
  2. Then set the prepend node path to true in case of your node is managed by nvm Add scripts-prepend-node-path=true to the end of content of .npmrc file.

  3. Pack without checking the health of your local app, Make sure your custom code is correct.

    yarn msdyn365 pack --skip-health-check

    Hope it is helpful for you guys.