abbr / deasync

Turns async function into sync via JavaScript wrapper of Node event loop
MIT License
964 stars 73 forks source link

yarn install fails #175

Open ghost opened 1 year ago

ghost commented 1 year ago

After switching to an M1 Mac I get the following error.

I tried adding a resolution to version 0.1.28 in my package.json which did not help.

elias@localhost frontend % ./yarn install            
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
warning Resolution field "fsevents@2.3.2" is incompatible with requested version "fsevents@^1.2.7"
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "nuxt > @nuxt/components@2.2.1" has unmet peer dependency "consola@*".
warning "nuxt-property-decorator > vuex-class@0.3.2" has unmet peer dependency "vuex@^3.0.0".
warning "nuxt-property-decorator > vuex-module-decorators@1.2.0" has unmet peer dependency "vuex@>=3".
warning " > @babel/eslint-parser@7.16.5" has unmet peer dependency "@babel/core@>=7.11.0".
warning "@nuxtjs/eslint-config-typescript > eslint-import-resolver-typescript@2.5.0" has unmet peer dependency "eslint-plugin-import@*".
warning "@nuxtjs/eslint-config-typescript > @nuxtjs/eslint-config > eslint-config-standard@16.0.3" has incorrect peer dependency "eslint@^7.12.1".
warning "@nuxtjs/eslint-config-typescript > @nuxtjs/eslint-config > eslint-plugin-promise@5.2.0" has incorrect peer dependency "eslint@^7.0.0".
warning "@nuxtjs/eslint-config-typescript > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > babel-core@7.0.0-bridge.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > babel-jest@27.4.5" has unmet peer dependency "@babel/core@^7.8.0".
warning "babel-jest > babel-preset-jest@27.4.0" has unmet peer dependency "@babel/core@^7.0.0".
warning "babel-jest > babel-preset-jest > babel-preset-current-node-syntax@1.0.1" has unmet peer dependency "@babel/core@^7.0.0".
warning "babel-jest > babel-preset-jest > babel-preset-current-node-syntax > @babel/plugin-syntax-bigint@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "babel-jest > babel-preset-jest > babel-preset-current-node-syntax > @babel/plugin-syntax-import-meta@7.10.4" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > ts-jest@27.1.2" has unmet peer dependency "typescript@>=3.8 <5.0".
warning " > ts-node@10.4.0" has unmet peer dependency "@types/node@*".
warning " > ts-node@10.4.0" has unmet peer dependency "typescript@>=2.7".
[4/4] 🔨  Building fresh packages...
[1/6] ⠁ core-js
[2/6] ⠁ core-js
[3/6] ⠁ vuex-module-decorators
[4/6] ⠁ deasync
error /Users/elias/Repositories/simons-ads/frontend/node_modules/deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments: 
Directory: /Users/elias/Repositories/simons-ads/frontend/node_modules/deasync
Output:
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn node-gyp ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn node-gyp',
  path: 'node-gyp',
  spawnargs: [ 'rebuild' ]
palexander commented 1 year ago

Using Yarn 3, I get a slightly different error that I believe has the same root cause:

➤ YN0007: │ deasync@npm:0.1.28 must be built because it never has b
een before or the last one failed
➤ YN0009: │ deasync@npm:0.1.28 couldn't be built successfully (ex
it code 1, logs can be found here: /private/var/folders/8c/xcgdny9557xd0w8bc7ndb6x80000gp/T/xfs-6376766d/build.log)
➤ YN0000: └ Completed in 2s 672ms
➤ YN0000: Failed with errors in 35s 200ms

$HOME/.npm/_npx/ea7c6e7510ea3309/node_modules/sao/lib/installPackages.js:108
        throw new SAOError(`Failed to install ${packageName} in ${cwd}`)
        ^

SAOError: Failed to install packages in $HOME/project_dir
    at ChildProcess.<anonymous> ($HOME/.npm/_npx/ea7c6e7510ea3309/node_modules/sao/lib/installPackages.js:108:15)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Socket.<anonymous> (node:internal/child_process:458:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:301:12) {
  __sao: true
}

Subsequent yarn install commands result in:

➤ YN0007: │ deasync@npm:0.1.28 must be built because it never has been before or the last one failed
➤ YN0009: │ deasync@npm:0.1.28 couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/8c/xcgdny9557xd0w8bc7ndb6x80000gp/T/xfs-39774a13/build.log)
➤ YN0000: └ Completed in 1s 89ms
➤ YN0000: Failed with errors in 1s 667ms

The error log contains:

# This file contains the result of Yarn building a package (deasync@npm:0.1.28)
# Script name: install

Usage Error: Couldn't find a script name "node-gyp" in the top-level (used by deasync@npm:0.1.28). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Build failed

This is also referenced in #155. Running yarn add node-gyp fixed it for me, but obviously not an ideal solution.

sonnyfishback-pdl commented 1 year ago

Experiencing the same issues. Any updates on this? @abbr

chiptus commented 1 year ago

it seems like it happens on node v20. reverting to use node v18 makes it work

trusktr commented 11 months ago

See this for a solution and workaround: