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

Install @ win 10 #85

Open
genesem opened this issue Sep 3, 2024 · 13 comments
Open

Install @ win 10 #85

genesem opened this issue Sep 3, 2024 · 13 comments

Comments

@genesem
Copy link

genesem commented Sep 3, 2024

The package just wont install on win10 with node 20.x and yarn.

Commands:
mkdir test && cd test
yarn init -y
yarn add -D @assetpack/core

The package 'cpu-features' it use, requires CMake according to their (npm) documentation:
https://www.npmjs.com/package/cpu-features#requirements

i.e. it won't able to build the 'cpu-features' package.


[4/4] Building fresh packages...
[1/3] ⠠ cpu-features
[-/3] ⠠ waiting...
error D:\DevWebPixi\.work\open-games-main\bubbo-bubbo\node_modules\cpu-features: Command failed.
Exit code: 1
Command: node buildcheck.js > buildcheck.gypi && node-gyp rebuild
Arguments:
Directory: D:\DevWebPixi\.work\open-games-main\bubbo-bubbo\node_modules\cpu-features
Output:
D:\DevWebPixi\.work\open-games-main\bubbo-bubbo\node_modules\buildcheck\lib\index.js:133
        throw new Error('Unable to detect compiler type');
        ^

Error: Unable to detect compiler type
    at new BuildEnvironment (D:\DevWebPixi\.work\open-games-main\bubbo-bubbo\node_modules\buildcheck\lib\index.js:133:15)
    at Object.<anonymous> (D:\DevWebPixi\.work\open-games-main\bubbo-bubbo\node_modules\cpu-features\buildcheck.js:5:12)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

@Element1493
Copy link

Element1493 commented Sep 4, 2024

Has the problem been solved?

npm error code 1
npm error path D:\Home\Desktop\demo\node_modules\cpu-features
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c node buildcheck.js > buildcheck.gypi && node-gyp rebuild
npm error D:\Home\Desktop\demo\node_modules\buildcheck\lib\index.js:133
npm error         throw new Error('Unable to detect compiler type');
npm error         ^
npm error
npm error Error: Unable to detect compiler type
npm error     at new BuildEnvironment (D:\Home\Desktop\demo\node_modules\buildcheck\lib\index.js:133:15)
npm error     at Object.<anonymous> (D:\Home\Desktop\demo\node_modules\cpu-features\buildcheck.js:5:12)
npm error     at Module._compile (node:internal/modules/cjs/loader:1546:14)
npm error     at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
npm error     at Module.load (node:internal/modules/cjs/loader:1317:32)
npm error     at Module._load (node:internal/modules/cjs/loader:1127:12)
npm error     at TracingChannel.traceSync (node:diagnostics_channel:315:14)
npm error     at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
npm error     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5)
npm error     at node:internal/main/run_main_module:30:49
npm error
npm error Node.js v22.8.0

@YVeselovskyi
Copy link

I have the same problem on macbook m1
Знімок екрана 2024-09-04 о 10 37 02

@Zyie
Copy link
Member

Zyie commented Sep 4, 2024

Hey everyone, thanks for raising the issue

@ddenisyuk this error seems to be coming from the gpu-tex-enc library. Any ideas what would be causing this?

@ddenisyuk
Copy link
Contributor

Checking...

@ddenisyuk
Copy link
Contributor

@genesem, @YVeselovskyi, @Element1493 As this is an environment-specific issue and I'm unable to reproduce it on my machine, could you please try installing the latest version of cpu-features directly?
yarn add -D [email protected]

@Element1493
Copy link

@ddenisyuk

PS D:\Home\Desktop\demo> yarn add -D [email protected]
yarn add v1.22.22
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error D:\Home\Desktop\demo\node_modules\cpu-features: Command failed.
Exit code: 1
Command: node buildcheck.js > buildcheck.gypi && node-gyp rebuild
Arguments:
Directory: D:\Home\Desktop\demo\node_modules\cpu-features
Output:
D:\Home\Desktop\demo\node_modules\buildcheck\lib\index.js:133
        throw new Error('Unable to detect compiler type');
        ^

Error: Unable to detect compiler type
    at new BuildEnvironment (D:\Home\Desktop\demo\node_modules\buildcheck\lib\index.js:133:15)
    at Object.<anonymous> (D:\Home\Desktop\demo\node_modules\cpu-features\buildcheck.js:5:12)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.17.0
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

@ddenisyuk
Copy link
Contributor

@Zyie In general, this is not an issue; it is due to the lack of environment prerequisites for the cpu-features library (CMake?).

The cpu-features library is used to detect supported CPU instructions to select the most appropriate encoder binary for optimal encoding speed. The only thing I can do from my side is to make this dependency optional, and the error can be bypassed by using the --omit=optional installation flag.

@genesem
Copy link
Author

genesem commented Sep 4, 2024

yarn add -D [email protected]

Same error as above.
Windows environment, usually does not have CLang compiler, so it won't build.

As a quick workaround it's possible to install / build in WSL, but it's quite a hussle.

Maybe it is possble to avoid to use "cpu-features" package at all?

@ddenisyuk
Copy link
Contributor

@Zyie In general, this is not an issue; it is due to the lack of environment prerequisites for the cpu-features library (CMake?).

The cpu-features library is used to detect supported CPU instructions to select the most appropriate encoder binary for optimal encoding speed. The only thing I can do from my side is to make this dependency optional, and the error can be bypassed by using the --omit=optional installation flag.

#86

@Zyie
Copy link
Member

Zyie commented Sep 5, 2024

hey @genesem can you check if 1.1.1 fixes this issue now that cpu-features is optional?

@ddenisyuk
Copy link
Contributor

hey @genesem can you check if 1.1.1 fixes this issue now that cpu-features is optional?

Please note that cpu-features is listed under optionalDependencies. Therefore, you need to use npm install --omit=optional or Yarn's equivalent.

@genesem
Copy link
Author

genesem commented Sep 5, 2024

Hey,
just tested it directly with the command yarn add -D --ignore-optional @assetpack/core
and in yarn --ignore-optional variant.
In both cases all packages was installed successfully.

But, npx assetpack command still does not work as there misses native modules:

D:\Test\assetpack\bubbo-bubbo>npx assetpack
D:\Test\assetpack\node_modules\@node-rs\crc32\index.js:359
    throw new Error('Failed to load native binding', { cause: loadErrors })
          ^

Error: Failed to load native binding
    at Object.<anonymous> (D:\Test\assetpack\node_modules\@node-rs\crc32\index.js:359:11)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at cjsLoader (node:internal/modules/esm/translators:346:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:286:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
    at async main (file:///D:/Test/assetpack/node_modules/@assetpack/core/dist/cli/index.js:39:23) {
  [cause]: [
    Error: Cannot find module './crc32.win32-x64-msvc.node'
    Require stack:
    - D:\Test\assetpack\node_modules\@node-rs\crc32\index.js
        at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
        at Module._load (node:internal/modules/cjs/loader:1051:27)
        at Module.require (node:internal/modules/cjs/loader:1311:19)
        at require (node:internal/modules/helpers:179:18)
        at requireNative (D:\Test\assetpack\node_modules\@node-rs\crc32\index.js:91:16)
        at Object.<anonymous> (D:\Test\assetpack\node_modules\@node-rs\crc32\index.js:332:17)
        at Module._compile (node:internal/modules/cjs/loader:1469:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
        at Module.load (node:internal/modules/cjs/loader:1288:32)
        at Module._load (node:internal/modules/cjs/loader:1104:12) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        'D:\\Test\\assetpack\\node_modules\\@node-rs\\crc32\\index.js'
      ]
    },
    Error: Cannot find module '@node-rs/crc32-win32-x64-msvc'
    Require stack:
    - D:\Test\assetpack\node_modules\@node-rs\crc32\index.js
        at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
        at Module._load (node:internal/modules/cjs/loader:1051:27)
        at Module.require (node:internal/modules/cjs/loader:1311:19)
        at require (node:internal/modules/helpers:179:18)
        at requireNative (D:\Test\assetpack\node_modules\@node-rs\crc32\index.js:96:16)
        at Object.<anonymous> (D:\Test\assetpack\node_modules\@node-rs\crc32\index.js:332:17)
        at Module._compile (node:internal/modules/cjs/loader:1469:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
        at Module.load (node:internal/modules/cjs/loader:1288:32)
        at Module._load (node:internal/modules/cjs/loader:1104:12) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        'D:\\Test\\assetpack\\node_modules\\@node-rs\\crc32\\index.js'
      ]
    }
  ]
}

Node.js v20.17.0


@genesem
Copy link
Author

genesem commented Sep 5, 2024

I'm sorry a bit.
Installed @node-rs/crc over with: yarn add -D @node-rs/crc32
And this fixed the issue and now npx assetpack command works as expected:

D:\Test\assetpack\bubbo-bubbo>npx assetpack
› Warn: [AssetPack] cache not found, clearing output folder
› Warn: [AssetPack] cache not found, clearing output folder
✔ AssetPack Initialized
› Building: D:/Test/assetpack/bubbo-bubbo/raw-assets
✔ AssetPack Completed in 2.14s
› Info: cache updated.


Thank a lot guys!

p.s. so under windows the sequence should be:

yarn add -D --ignore-optional @assetpack/core
yarn add -D @node-rs/crc32

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

5 participants