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

fix: osx hide-bazel-files issue with fsevents #1578

Merged

Conversation

gregmagolan
Copy link
Collaborator

@gregmagolan gregmagolan commented Jan 28, 2020

// If an optional dependency failed to install it is possible that readdirSync will
// return a folder name that no longer exists and lstatSync will throw with an error such as
// `Error: ENOENT: no such file or directory, lstat
// '/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-49206kt9HWV3A8daE/node_modules/fsevents'`
// This seems to be because yarn does parallel installs and runs parallel step.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@gregmagolan
Copy link
Collaborator Author

gregmagolan commented Jan 28, 2020

NB: I can reproduce the same gyp: No Xcode or CLT version detected! failure followed by the hide-bazel-files failure when running yarn directly outside of Bazel:

greg@Air-Force-One tmp-60611XHY0jTO50VWs $ yarn
yarn install v1.21.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
warning @angular-devkit/architect-cli@0.900.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular-devkit/architect@0.900.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular-devkit/core@9.0.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-angular@0.900.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-optimizer@0.900.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-webpack@0.900.0-rc.7: The engine "pnpm" appears to be invalid.
warning @ngtools/webpack@9.0.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular/cli@9.0.0-rc.7: The engine "pnpm" appears to be invalid.
warning @angular-devkit/schematics@9.0.0-rc.7: The engine "pnpm" appears to be invalid.
warning @schematics/angular@9.0.0-rc.7: The engine "pnpm" appears to be invalid.
warning @schematics/update@0.900.0-rc.7: The engine "pnpm" appears to be invalid.
info @bazel/bazel-linux_x64@2.0.0: The platform "darwin" is incompatible with this module.
info "@bazel/bazel-linux_x64@2.0.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @bazel/bazel-win32_x64@2.0.0: The platform "darwin" is incompatible with this module.
info "@bazel/bazel-win32_x64@2.0.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @bazel/buildifier-linux_x64@0.29.0: The platform "darwin" is incompatible with this module.
info "@bazel/buildifier-linux_x64@0.29.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info @bazel/buildifier-win32_x64@0.29.0: The platform "darwin" is incompatible with this module.
info "@bazel/buildifier-win32_x64@0.29.0" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] 🔗  Linking dependencies...
warning " > html-webpack-plugin@3.2.0" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0".
warning " > karma-jasmine-html-reporter@1.5.1" has incorrect peer dependency "jasmine-core@>=3.5".
[4/4] 🔨  Building fresh packages...
[1/6] ⠂ puppeteer
[2/6] ⠂ fsevents
[6/6] ⠂ @bazel/hide-bazel-files
[-/6] ⠂ waiting...
warning Error running install script for optional dependency: "/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/fsevents: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/fsevents
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@12.4.0 | darwin | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/Users/greg/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/fsevents/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/greg/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/greg/.node-gyp/12.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/greg/.node-gyp/12.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/greg/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/greg/.node-gyp/12.4.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/fsevents',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/greg/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command \"/Users/greg/.nvm/versions/node/v12.4.0/bin/node\" \"/Users/greg/.nvm/versions/node/v12.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/fsevents
[1/6] ⠈ puppeteer
[-/6] ⠈ waiting...
[6/6] ⠈ @bazel/hide-bazel-files
[-/6] ⠈ waiting...
error /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/@bazel/hide-bazel-files: Command failed.
Exit code: 1
Command: node ./index.js
Arguments: 
Directory: /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/@bazel/hide-bazel-files
Output:
fs.js:126
    throw err;
    ^

Error: ENOENT: no such file or directory, lstat '/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/fsevents'
    at Object.lstatSync (fs.js:847:3)
    at /private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/@bazel/hide-bazel-files/index.js:13:31
    at Array.reduce (<anonymous>)
    at findBazelFiles (/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/@bazel/hide-bazel-files/index.js:11:30)
    at main (/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/@bazel/hide-bazel-files/index.js:54:13)
    at Object.<anonymous> (/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-60611XHY0jTO50VWs/node_modules/@bazel/hide-bazel-files/index.js:64:22)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12) {
  errno: -2,
  syscall: 'lstat',

@gregmagolan
Copy link
Collaborator Author

gregmagolan commented Jan 28, 2020

On further investigation, it seems that yarn is likely doing parallel "postinstall" steps for packages and the underlying issue may be that that hide-bazel-files is not respecting its package boundary and readdirSync is working correctly.

Also, for reference, I fixed the xcode issue on OSX Catelina with the instructions here: schnerd/d3-scale-cluster#7 (comment)

// If an optional dependency failed to install it is possible that readdirSync will
// return a folder name that no longer exists and lstatSync will throw with an error such as
// `Error: ENOENT: no such file or directory, lstat
// '/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-49206kt9HWV3A8daE/node_modules/fsevents'`
// This seems to be because yarn does parallel installs and runs parallel step.
@gregmagolan gregmagolan merged commit 64a31ab into bazel-contrib:master Jan 29, 2020
@petebacondarwin
Copy link

Yay! I just came across this. It is so satisfying to find a bug and see that it was already fixed (only hours before!). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants