Jigsaw-Code / outline-apps

Outline Client and Manager, developed by Jigsaw. Outline Manager makes it easy to create your own VPN server. Outline Client lets you share access to your VPN with anyone in your network, giving them access to the free and open internet.
https://getoutline.org/
Apache License 2.0
8.39k stars 1.36k forks source link

[Bug]: Build error on Windows #2016

Closed AmRo045 closed 3 months ago

AmRo045 commented 4 months ago

Application

Outline Client

Describe the bug

I’m trying to build the Outline client for Windows by executing the following command after completing the basic setup. However, I encounter the following error: the build command:

npm run action client/electron/build windows

the output:

outline-apps on master ≡ via  18.20.2
➜ npm run action client/electron/build windows

> action
> node ./src/build/run_action.mjs client/electron/build windows

       / __ \| |  | |__   __| |    |_   _| \ | |  ____|
      | |  | | |  | |  | |  | |      | | |  \| | |__
      | |  | | |  | |  | |  | |      | | | . ` |  __|
      | |__| | |__| |  | |  | |____ _| |_| |\  | |____
       \____/ \____/   |_|  |______|_____|_| \_|______|

  =========================================================
               © The Outline Authors, 2023
  =========================================================

▶ action(client/electron/build):
  Running [node '--trace-uncaught' 'C:\Users\AmRo\Desktop\outline-apps\client\electron\build.action.mjs' 'windows']...
  ▶ action(client/src/www/build):
    Running [node '--trace-uncaught' 'C:\Users\AmRo\Desktop\outline-apps\client\src\www\build.action.mjs' 'windows']...
  ▶ action(client/src/www/build): 🎉 Success! (6815ms)
  ▶ action(client/src/tun2socks/build):
    Running [node '--trace-uncaught' 'C:\Users\AmRo\Desktop\outline-apps\client\src\tun2socks\build.action.mjs' 'windows']...
    Running [go 'run' 'github.com/go-task/task/v3/cmd/task' '-v' 'client:tun2socks:windows']...
    task: [C:\Users\AmRo\Desktop\outline-apps] Not found - Using alternative (Taskfile.yml)

  ERROR(spawn_stream): node --trace-uncaught C:\Users\AmRo\Desktop\outline-apps\client\electron\build.action.mjs windows failed with exit code 1.}
  Printing stderr:
  WARNING: building "windows" in [DEBUG] mode. Do not publish this build!!
    ERROR(spawn_stream): node --trace-uncaught C:\Users\AmRo\Desktop\outline-apps\client\src\tun2socks\build.action.mjs windows failed with exit code 1.}
    Printing stderr:
    ERROR(spawn_stream): go run github.com/go-task/task/v3/cmd/task -v client:tun2socks:windows failed with exit code 1.}
    Printing stderr:
    task: "client:tun2socks:windows" started

    task: "client:tun2socks:electron" started

    task: [client:tun2socks:electron] rm -rf "C:\Users\AmRo\Desktop\outline-apps\client\output\build/windows" && mkdir -p "C:\Users\AmRo\Desktop\outline-apps\client\output\build/windows"

    "rm": executable file not found in $PATH
    task: Failed to run task "client:tun2socks:windows": exit status 127

    exit status 201
    node:internal/process/esm_loader:40
          internalBinding('errors').triggerUncaughtException(
                                    ^
    task: "client:tun2socks:windows" startedtask: "client:tun2socks:electron" startedtask: [client:tun2socks:electron] rm -rf "C:\Users\AmRo\Desktop\outline-apps\client\output\build/windows" && mkdir -p "C:\Users\AmRo\Desktop\outline-apps\client\output\build/windows""rm": executable file not found in $PATHtask: Failed to run task "client:tun2socks:windows": exit status 127exit status 201
    Thrown at:
        at loadESM (node:internal/process/esm_loader:40:33)
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
    Node.js v18.20.2
  ▶ action(client/src/tun2socks/build): ❌ Failed.
▶ action(client/electron/build): ❌ Failed.

NOTE the start command works and open the client in the browser, but I couldn't add any key.

Steps to reproduce

  1. Clone the repo
  2. Run the npm install
  3. Install go lang
  4. Run the build command for Windows: npm run action client/electron/build windows

What did you expect to happen?

No response

What actually happened?

No response

Outline Version

1.10.1

What operation system are you using?

Windows

Operating System Version

11 pro (10.0.22631 N/A Build 22631)

Screenshots and Videos

image

cornzzy commented 4 months ago

Is that cmd or powershell? rm is available on powershell but not on cmd.

AmRo045 commented 4 months ago

it is powershell

jyyi1 commented 4 months ago

Hi @AmRo045 , we are using the rimraf NPM package to run rm -rf util for all platforms, it should be installed to your node_module by our package.json. Please make sure you have run npm ci and your Node.js environment can successfully run the binaries in node_modules.

AmRo045 commented 4 months ago

Hi @jyyi1, thanks for your help. I have run the npm install in the root and client directories, and here is the output:

root dir:

outline-apps on master ≡ via  18.20.3 x
➜ npm install
npm warn skipping integrity check for git dependency ssh://git@github.com/apache/cordova-ios.git
npm warn deprecated @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
npm warn deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm warn deprecated @hapi/pinpoint@1.0.2: Moved to 'npm install @sideway/pinpoint'
npm warn deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm warn deprecated @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
npm warn deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm warn deprecated @hapi/formula@1.2.0: Moved to 'npm install @sideway/formula'
npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm warn deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm warn deprecated date-format@2.1.0: 2.x is no longer supported. Please upgrade to 4.x or higher.
npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm warn deprecated @material/mwc-line-ripple@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-floating-label@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm warn deprecated @material/mwc-icon@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm warn deprecated asar@3.2.0: Please use @electron/asar moving forward.  There is no API change, just a package name change
npm warn deprecated @material/mwc-textarea@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-formfield@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-notched-outline@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm warn deprecated streamroller@1.0.6: 1.x is no longer supported. Please upgrade to 3.x or higher.
npm warn deprecated @material/mwc-textfield@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-select@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-checkbox@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-circular-progress@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-radio@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated @material/mwc-ripple@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated electron-osx-sign@0.6.0: Please use @electron/osx-sign moving forward. Be aware the API is slightly different
npm warn deprecated @material/mwc-button@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm warn deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm warn deprecated @material/mwc-menu@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated electron-notarize@1.2.2: Please use @electron/notarize moving forward.  There is no API change, just a package name change
npm warn deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm warn deprecated log4js@4.5.1: 4.x is no longer supported. Please upgrade to 6.x or higher.
npm warn deprecated @hapi/joi@16.1.8: Switch to 'npm install joi'
npm warn deprecated @material/mwc-list@0.27.0: MWC beta is longer supported. Please upgrade to @material/web
npm warn deprecated intl-messageformat-parser@3.6.4: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
npm warn deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:
npm warn deprecated   npm i nyc
npm warn deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm warn deprecated @formatjs/intl-utils@2.3.0: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
npm warn deprecated @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat

added 3079 packages, changed 1 package, and audited 3086 packages in 16m

320 packages are looking for funding
  run `npm fund` for details

93 vulnerabilities (5 low, 43 moderate, 41 high, 4 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

client dir:

client on master ≡ via  18.20.3
➜ npm install

up to date, audited 3085 packages in 37s

320 packages are looking for funding
  run `npm fund` for details

75 vulnerabilities (4 low, 41 moderate, 26 high, 4 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

As I mentioned earlier, the start command works, but I cannot add any key (the add button does nothing). image

When I run the build command for the first time, it outputs this: image

After that, when I run it again, I get the same error: image

Also, I noticed that there is no rimraf package inside node_modules even though it is defined in package.json. Here is the content of the client node_modules directory: image

jyyi1 commented 4 months ago

@AmRo045, thanks for the details. Unfortunately I am still not able to reproduce this issue. Since you're using a customized terminal, maybe its environment configuration is causing this issue?

the start command works

Actually the start command is broken, so I wouldn't recommend using it. We're working on a solution.

When I run the build command for the first time, it outputs this

The correct build command should be client/electron/build, not client/src/www/build.

Also, I noticed that there is no rimraf package inside node_modules

The rimraf package should be in the root node_modules folder, not the one in the client folder. All commands need to be run from the repository's root folder. And you should not run npm install in the client folder either.

when I run it again, I get the same error.

I've tested this with the built-in PowerShell (without Unix tools), and it works fine. Also our Windows GitHub CI build indicates that the build command is working as well. I have attached the expected PowerShell output image below. (you can see from the last two commands, I only have the PowerShell's built-in rm, not the Unix rm)

image
AmRo045 commented 3 months ago

@jyyi1, you're right, probably something is wrong with my environment. Thanks for your help.