WebCord icon indicating copy to clipboard operation
WebCord copied to clipboard

Namespace 'NodeJS' has no exported member 'Architecture'

Open eclairevoyant opened this issue 2 years ago • 5 comments

Acknowledgements

  • [x] There's no other issue describing the same problem, regardless of its current state (i.e. including both closed and open issues).*
  • [x] There's no fix for my issue released to master branch.*
  • [ ] This issue has known workaround (write it below).

* Required

Environment

  • Platform: Arch Linux
  • Architecture: x86_64
  • Electron version: v19.0.10
  • Application version: v3.6.0
  • TypeScript compiler version: 4.7.4
  • Node.js package manager: npm
    • Node.js package manger version: 8.15.1

Describe the problem

==> Starting build()...
sources/code/common/modules/agent.ts:8:26 - error TS2694: Namespace 'NodeJS' has no exported member 'Architecture'.

8   switch (arch as NodeJS.Architecture) {
                           ~~~~~~~~~~~~


Found 1 error in sources/code/common/modules/agent.ts:8

==> ERROR: A failure occurred in build().
    Aborting...

To Reproduce

Steps to reproduce the behavior:

  1. Clone https://aur.archlinux.org/webcord.git to a clean directory like /tmp
  2. Change pkgver to 3.6.0
  3. Run updpkgsums to update checksums
  4. Run makepkg -fs

Expected behavior

No errors during build

Screenshots

n/a

Additional context

Change that causes this error was added in 5cd84c4a09159e15ef6eda261baaf8741da7437e; I don't really use nodejs and didn't investigate further

eclairevoyant avatar Aug 02 '22 01:08 eclairevoyant

It doesn't fail for me when directly building (without makepkg) as well as GitHub Actions confirms that package.json includes all needed type definitions definied as devDependencies (it does not fail). What is likely falling is webcord PKGBUILD.

Since I do not maintain webcord, I am not going to fix it. Right now I'll flag this as invalid and wontfix. You're free to however use webcord-git package, which while uses the latest available development version of WebCord, I maintain it and try to reduce the number of the breakages (you don't have to report them through, GitHub already informs me if the build is failing). And by opting in for webcord-git you can easily test features and report them before they reach releases.

SpacingBat3 avatar Aug 02 '22 09:08 SpacingBat3

Take a look at this part of webcord's PKGBUILD:

prepare() {
    cd "${srcdir}"
    npm i --ignore-scripts \
        "@tsconfig/node16-strictest"@"^1.0.0" \
        "@types/dompurify"@"^2.3.3" \
        "@types/marked"@"^4.0.2" \
        "@types/semver"@"^7.3.9" \
        "@types/source-map-support"@"^0.5.4" \
        "@types/spdx-expression-parse"@"^3.0.1" \
        "@types/ws"@"^8.5.1" \
        "electron"@"^19.0.1"

    cd "${_srcname}"
    npm i --omit=dev --ignore-scripts
    rm -r "sources/code/build"
}

It seems to be missing @types/node. WebCord does not include them in their package.json as well, but I believe it is normally installed anyway (I believe electron already provides it and maybe it is good idea to leave it as it is, since I would then need to keep @types/node at the same version as it is in electron). I've also confirmed that webcord-git is still functional.

SpacingBat3 avatar Aug 02 '22 10:08 SpacingBat3

UPDATE: Actually I've found that @types/node is being installed, but npm i --omit=dev removes it. It then further fails because of this. Definitely an issue caused by PKGBUILD, outside of WebCord's interest.

I'll close this issue, it is definitely a problem with PKGBUILD that has nothing to do with WebCord.

SpacingBat3 avatar Aug 02 '22 11:08 SpacingBat3

Sounds strange, but seems like this is indeed kind of a bug. Current electron@19 package actually depends on @types/node@16, but this version doesn't contain definition for NodeJS.Architecture. This only works in your build because some other package accidently brings higher @types/node version into the scope. But this is only a typing issue and not affects a runtime.

HanabishiRecca avatar Aug 06 '22 01:08 HanabishiRecca

Current electron@19 package actually depends on @types/node@16, but this version doesn't contain definition for NodeJS.Architecture.

Oh, that seems to actually be a reason. I think I'll just add newer type definitions, they're generally better bringing literals like NodeJS.Architecture and probably won't conflict much with the older Node API.

SpacingBat3 avatar Aug 06 '22 08:08 SpacingBat3