inshellisense icon indicating copy to clipboard operation
inshellisense copied to clipboard

Install binary package via common package managers (winget, brew, etc)

Open cpendery opened this issue 1 year ago • 3 comments

Combining #110, #32, #82, & #84 to make it easier for people to track the resolution.

As discussed in https://github.com/microsoft/inshellisense/issues/32#issuecomment-1984759946, there isn't a feasible solution yet to making the binary package that would enable distributing inshellisense via package manager. If Node 21 or Bun support gets added to node-pty, I'll retry those methods of creating the binary package. I don't want to create a dependency on any archived projects for now

cpendery avatar Mar 09 '24 21:03 cpendery

I've been trying to package it into brew. but have encountered an error in actual testing that hasn't been resolved yet.

The root cause of the following two errors is because node-pty is not compiled to the right version. I manually deleted @homebridge/node-pty-prebuilt-multiarch and executed npm i and it was back to normal.

My version under /usr/local/bin/node is v18.16.1.

innerError Error: Cannot find module '../build/Debug/pty.node'
Require stack:
- /opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/prebuild-loader.js
- /opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/unixTerminal.js
- /opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/prebuild-loader.js:10:15)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/prebuild-loader.js',
    '/opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/unixTerminal.js',
    '/opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/index.js'
  ]
}
node:internal/modules/cjs/loader:1340
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '/opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/build/Release/pty.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 120. This version of Node.js requires
NODE_MODULE_VERSION 108. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/opt/homebrew/Cellar/inshellisense/0.0.1-rc.13/libexec/lib/node_modules/@microsoft/inshellisense/node_modules/@homebridge/node-pty-prebuilt-multiarch/lib/prebuild-loader.js:6:11)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v18.16.1

alanhe421 avatar Apr 14 '24 15:04 alanhe421

Combining #110, #32, #82, & #84 to make it easier for people to track the resolution.

As discussed in #32 (comment), there isn't a feasible solution yet to making the binary package that would enable distributing inshellisense via package manager. If Node 21 or Bun support gets added to node-pty, I'll retry those methods of creating the binary package. I don't want to create a dependency on any archived projects for now

@cpendery For advice, what exactly do you mean by archived projects here?

alanhe421 avatar Apr 15 '24 01:04 alanhe421

Combining #110, #32, #82, & #84 to make it easier for people to track the resolution. As discussed in #32 (comment), there isn't a feasible solution yet to making the binary package that would enable distributing inshellisense via package manager. If Node 21 or Bun support gets added to node-pty, I'll retry those methods of creating the binary package. I don't want to create a dependency on any archived projects for now

@cpendery For advice, what exactly do you mean by archived projects here?

If we migrated everything into common js, we might be able to use pkg to compile our code into a binary executable which would be easier to distribute. It handles compiling node-pty, so we could stop using the @homebrew version, but I didn't want to depend on the project since they just deprecated it in January

cpendery avatar Apr 15 '24 02:04 cpendery

I've tried using node's sea support in 22, pkg, and bun doesn't seem to have node-pty support yet.

Overall, I don't see a viable solution to this in the near term. Closing this issue, but I'll reopen it if it becomes possible

cpendery avatar Aug 23 '24 20:08 cpendery