Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac build: fsevents Unexpected character (1:0) #1333

Closed
Venipa opened this issue Apr 20, 2021 · 5 comments
Closed

mac build: fsevents Unexpected character (1:0) #1333

Venipa opened this issue Apr 20, 2021 · 5 comments

Comments

@Venipa
Copy link

Venipa commented Apr 20, 2021

Describe the bug
If i want to build the mac dmg via github actions it runs until it wants to bundle the release:
Mac os build logs can be found here: https://github.com/Venipa/ytmdesktop2/runs/2395324300

-  Bundling main process...
 ERROR  Failed to compile with 1 errors10:35:03 PM

 error  in ./node_modules/fsevents/fsevents.node

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/fsevents/fsevents.js 13:15-41
 @ ./node_modules/chokidar/lib/fsevents-handler.js
 @ ./node_modules/chokidar/index.js
 @ ./node_modules/sass/sass.dart.js
 @ ./src/app/utils/webContentUtils.ts
 @ ./src/app/main.ts
 @ ./src/background.ts
 @ multi ./src/background.ts

To Reproduce
Steps to reproduce the behavior:

  • get your mac instance/machine
  • git clone https://github.com/Venipa/ytmdesktop2
  • yarn release --mac or just yarn release

Expected behavior
No Error 👍

Screenshots
image

Environment (please complete the following information):

Additional context
Last run with failed mac-os build: https://github.com/Venipa/ytmdesktop2/runs/2395324300 (contains the error)

@Venipa
Copy link
Author

Venipa commented Apr 20, 2021

ok, i've added a resolution to a previous version of chokidar and it works for now

// in package.json
"resolutions": {
    "chokidar": "2.1.8"
  },

well its just a workaround

@nklayman
Copy link
Owner

I tried the repo you shared and it works just fine, even without the chokidar version resolution (I am on Linux though, so that might negate the issue). I don't have a mac to test it unfortunately. The Github action run you linked to actually succeeded on Mac, but failed on windows because of an unrelated issue. Can you share a link to a workflow run that actually failed on Mac? From what you posted, it seems that marking chokidar as an external would fix it.

@Venipa
Copy link
Author

Venipa commented Apr 24, 2021

I tried the repo you shared and it works just fine, even without the chokidar version resolution (I am on Linux though, so that might negate the issue). I don't have a mac to test it unfortunately. The Github action run you linked to actually succeeded on Mac, but failed on windows because of an unrelated issue. Can you share a link to a workflow run that actually failed on Mac? From what you posted, it seems that marking chokidar as an external would fix it.

yes the mac build reported "succeeded" but it still failed which resulted in no publish:
image

undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue Dec 31, 2021
Upgrade to v5.x using `vue upgrade --next`.

Update `vue.config.js` to import and use `defineConfig`, because it
provides type safety and created by Vue CLI 5 as default.

Vue CLI 5.x upgrades from webpack 4 to 5. It causes some issues that this
commit attemps to fix:

1. Fail due to webpack resolving of Ace.
   Third-party dependency (code editor) Ace uses legacy `file-loader`
   for webpack resolving. It's not supported in webpack 5. So change it
   with manual imports.
   Refs: ajaxorg/ace-builds#211, ajaxorg/ace-builds#221.

2. Wehpack drops polyfilling node core modules (`path`, `fs`, etc.).
   Webpack does not polyfill those modules by default anymore. This is
   good because they did not need browser polyfilling as they are
   used in desktop version only and resolved already by Electron.
   To resolve errors (using webpack recommendations):
    - Add typeof check around `process` variable.
    - Tell webpack explicitly to ignore used node modules.

3. Fail due to legacy dependency of vue-cli-plugin-electron-builder.
   This plugin is used for electron builds and development. It still
   uses webpack 4 that leads to failed builds.
   Downgrading `ts-loader` to latest version which has support for
   `loader-utils` solves the problem (TypeStrong/ts-loader#1288).
   Related issue: nklayman/vue-cli-plugin-electron-builder#1625

4. Compilation fails due to webpack loading of `fsevents` on macOS.
   This happens only when running `vue-cli-service test:unit` command
   (used in integration tests and unit tests). Other builds work fine.
   Refs: yan-foto/electron-reload#71,
     nklayman/vue-cli-plugin-electron-builder#712,
     nklayman/vue-cli-plugin-electron-builder#1333
@undergroundwires
Copy link

I had the same problem only for running vue-cli-service test:unit command on macOS. Solved it by setting fsevents inside as external in configureWebpack of vue.config.js:

module.exports = defineConfig({
    configureWebpack: {
        externals: ['fsevents'],
    },

Or:

module.exports = defineConfig({
    configureWebpack: {
        externals: {
            'fsevents': 'require("fsevents")'
        },
    },

Both works.

@nklayman
Copy link
Owner

nklayman commented Jan 2, 2022

Seems like this is a duplicate of #712 then. Thanks for the help @undergroundwires.

@nklayman nklayman closed this as completed Jan 2, 2022
LarrMarburger pushed a commit to LarrMarburger/privacy.sexy that referenced this issue Nov 16, 2023
Upgrade to v5.x using `vue upgrade --next`.

Update `vue.config.js` to import and use `defineConfig`, because it
provides type safety and created by Vue CLI 5 as default.

Vue CLI 5.x upgrades from webpack 4 to 5. It causes some issues that this
commit attemps to fix:

1. Fail due to webpack resolving of Ace.
   Third-party dependency (code editor) Ace uses legacy `file-loader`
   for webpack resolving. It's not supported in webpack 5. So change it
   with manual imports.
   Refs: ajaxorg/ace-builds#211, ajaxorg/ace-builds#221.

2. Wehpack drops polyfilling node core modules (`path`, `fs`, etc.).
   Webpack does not polyfill those modules by default anymore. This is
   good because they did not need browser polyfilling as they are
   used in desktop version only and resolved already by Electron.
   To resolve errors (using webpack recommendations):
    - Add typeof check around `process` variable.
    - Tell webpack explicitly to ignore used node modules.

3. Fail due to legacy dependency of vue-cli-plugin-electron-builder.
   This plugin is used for electron builds and development. It still
   uses webpack 4 that leads to failed builds.
   Downgrading `ts-loader` to latest version which has support for
   `loader-utils` solves the problem (TypeStrong/ts-loader#1288).
   Related issue: nklayman/vue-cli-plugin-electron-builder#1625

4. Compilation fails due to webpack loading of `fsevents` on macOS.
   This happens only when running `vue-cli-service test:unit` command
   (used in integration tests and unit tests). Other builds work fine.
   Refs: yan-foto/electron-reload#71,
     nklayman/vue-cli-plugin-electron-builder#712,
     nklayman/vue-cli-plugin-electron-builder#1333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants