redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 440 forks source link

vscode-java doesn't build on Mac with Node 14 #2702

Open fbricon opened 2 years ago

fbricon commented 2 years ago

Using the same node 14.19.1 as Jenkins, the project fails to build on my Mac.

❯ node --version
v14.19.1
❯ npm ci
npm WARN prepare removing existing node_modules/ before installation

> fsevents@1.2.13 install /Users/fbricon/Dev/projects/vscode-java/node_modules/glob-watcher/node_modules/fsevents
> node install.js

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'nan'
Require stack:
- /Users/fbricon/Dev/projects/vscode-java/node_modules/glob-watcher/node_modules/fsevents/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:134:12)
    at Object.runInThisContext (vm.js:310:38)
    at internal/process/execution.js:81:19
    at [eval]-wrapper:6:22
    at evalScript (internal/process/execution.js:80:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/fbricon/Dev/projects/vscode-java/node_modules/glob-watcher/node_modules/fsevents/[eval]'
  ]
}
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/fbricon/.nvm/versions/node/v14.19.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/fbricon/.nvm/versions/node/v14.19.1/bin/node" "/Users/fbricon/.nvm/versions/node/v14.19.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/fbricon/Dev/projects/vscode-java/node_modules/glob-watcher/node_modules/fsevents
gyp ERR! node -v v14.19.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
added 875 packages in 13.275s

It builds when I start using Node 16

rgrunber commented 2 years ago

According to https://github.com/fsevents/fsevents/issues/321, it's because we're using an old version of fsevents.

$ npm ls fsevents
java@1.11.0 /home/rgrunber/git/vscode-java
├─┬ chokidar@3.5.3
│ └── UNMET OPTIONAL DEPENDENCY fsevents@2.3.2 
└─┬ gulp@4.0.2
  └─┬ glob-watcher@5.0.5
    └─┬ chokidar@2.1.8
      └── UNMET OPTIONAL DEPENDENCY fsevents@1.2.13 

So the issue is https://github.com/gulpjs/glob-watcher/issues/55 , https://github.com/gulpjs/gulp/issues/2654 . Are you able to use --no-optional to fix it on Node 14 ?