CopilotForXcode icon indicating copy to clipboard operation
CopilotForXcode copied to clipboard

Unavailable Node.js installed with nodenv(Anyenv)

Open hulk510 opened this issue 1 year ago • 15 comments

My node is installed by nodenv(Anyenv), and install CopilotForXcode with brew cask.

which node return /Users/username/.anyenv/envs/nodenv/shims/node. I write path to Path to Node, then show Server unavailable, please make sure installed Node.

refresh did not change error message. so I tried to install Node with brew, rewrite Path to Node to /opt/homebrew/Cellar/node/19.8.1/bin/node is fixed.

スクリーンショット 2023-03-21 12 36 54

env

  • node v19.8.1
  • CopilotForXcode 0.8.6

Expected behavior

it maybe my environment, but I want to be able to specify Node with nodenv as well.

hulk510 avatar Mar 21 '23 03:03 hulk510

Please check your /Users/username/.anyenv/envs/nodenv/shims/node version, and make sure it's v16+

intitni avatar Mar 21 '23 04:03 intitni

thanks😊

current my nodeenv node version is 19.8.1 スクリーンショット 2023-03-21 15 14 12

I've downgraded v16.18.1, but it doesn't seem to change. 🤔

hulk510 avatar Mar 21 '23 06:03 hulk510

Please try setting up the language server manually by calling /Users/username/.anyenv/envs/nodenv/shims/node /Applications/Copilot\ for\ Xcode.app/Contents/Applications/CopilotForXcodeExtensionService.app/Contents/Resources/copilot/dist/agent.js --stdio

intitni avatar Mar 21 '23 06:03 intitni

スクリーンショット 2023-03-21 16 02 29

here is response

Content-Length: 232

{"jsonrpc":"2.0","method":"LogMessage","params":{"level":0,"message":"[DEBUG] [agent] [2023-03-21T07:02:22.483Z] Agent service starting","metadataStr":"[DEBUG] [agent] [2023-03-21T07:02:22.483Z]","extra":["Agent service starting"]}}

hulk510 avatar Mar 21 '23 07:03 hulk510

I have tried that if I use the path that points to a specific version of Node installed via nodenv, it will work.

For example, Users/username/.nodenv/versions/19.8.1/bin/node

The node inside shims is actually not a real node, if I understand it correctly, according to nodenv documentation:

Shims are lightweight executables that simply pass your command along to nodenv. So with nodenv installed, when you run, say, npm, your operating system will do the following:

  • Search your PATH for an executable file named npm
  • Find the nodenv shim named npm at the beginning of your PATH
  • Run the shim named npm, which in turn passes the command along to nodenv

I will add it to FAQ in the next release.

intitni avatar Mar 21 '23 07:03 intitni

I see. thanks!

hulk510 avatar Mar 21 '23 07:03 hulk510

I'm having the same problem and tried to set Path to Node to the specific path, but it didn't work

https://user-images.githubusercontent.com/3942121/226794972-0da5a718-0b63-4028-8b62-0ca1155930b4.mov

Am I missing something?

el-hoshino avatar Mar 22 '23 03:03 el-hoshino

I'm having the same problem and tried to set Path to Node to the specific path, but it didn't work

Am I missing something?

Change ~ to /Users/yourusername and restart the app

intitni avatar Mar 22 '23 03:03 intitni

Facing a similar issue using nvm image image

talis-manick avatar Mar 23 '23 00:03 talis-manick

Facing a similar issue

image image

restart the app and the helper

intitni avatar Mar 23 '23 00:03 intitni

restart the app and the helper

The issue persists after restarting the helper and also restarting system.

Update: after switching to node v19.8.1, it is now working

talis-manick avatar Mar 23 '23 01:03 talis-manick

I tried restarting the system and switched from node 18 nvm to node 19 with brew. Still not working for me

image image

adiRandom avatar Mar 25 '23 09:03 adiRandom

Please show me the error message

I tried restarting the system and switched from node 18 nvm to node 19 with brew. Still not working for me

image image

Please show me the error message

intitni avatar Mar 25 '23 10:03 intitni

Please show me the error message

I tried restarting the system and switched from node 18 nvm to node 19 with brew. Still not working for me image image

Please show me the error message Same as the others. Sorry for not including it 😅 image

adiRandom avatar Mar 25 '23 10:03 adiRandom

@adiRandom I have tried version 19.8.1 from brew, and it works for me. To find out the cause, you can open Console.app to observe the logs post by the process CopilotForXcodeExtensionService and subsystem com.chimehq.JSONRPC

intitni avatar Mar 25 '23 13:03 intitni

https://github.com/intitni/CopilotForXcode/issues/63#issuecomment-1477386420

I have tried that if I use the path that points to a specific version of Node installed via nodenv, it will work.

For example, Users/username/.nodenv/versions/19.8.1/bin/node

The node inside shims is actually not a real node, if I understand it correctly, according to nodenv documentation:

Shims are lightweight executables that simply pass your command along to nodenv. So with nodenv installed, when you run, say, npm, your operating system will do the following:

  • Search your PATH for an executable file named npm
  • Find the nodenv shim named npm at the beginning of your PATH
  • Run the shim named npm, which in turn passes the command along to nodenv

I will add it to FAQ in the next release.

I'm user of anyenv. This solution works for me! Thanks!!

I could set with changing "Path to Node" /Users/nukopy/.anyenv/envs/nodenv/shims/node to /Users/nukopy/.anyenv/envs/nodenv/versions/18.7.0/bin/node.

nukopy avatar Mar 29 '23 16:03 nukopy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 29 '23 01:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 14 '23 01:05 github-actions[bot]