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

Cannot install on macOS arm64 due to outdated CLI version #15

Closed
wookayin opened this issue Feb 8, 2022 · 12 comments · Fixed by #23
Closed

Cannot install on macOS arm64 due to outdated CLI version #15

wookayin opened this issue Feb 8, 2022 · 12 comments · Fixed by #23

Comments

@wookayin
Copy link

wookayin commented Feb 8, 2022

I ran into an error saying npm ERR! Error: Cannot install tree-sitter-cli for architecture arm64 (tree-sitter/tree-sitter#942) while installing tree-sitter-phpdoc.

This is because of tree-sitter-cli version is set to ^0.17.3 -- The issue has been fixed in tree-siter-cli v0.18.3+. Can you update the dependency version so that I can install the module on a arm64 mac? Thanks!

@mikehaertl
Copy link

See the discussion here for why an update is still postponed: #2

@claytonrcarter
Copy link
Owner

Yes, @mikehaertl is correct. That said, I understand that the latest TS (0.20.3 or .4) allows us to generate parsers for arbitrary ABIs. I'll try to play with this to see if we can update to latest TS but then commit the older ABI parsers for use on npm and Atom. That way, anyone could get the latest version as well, just by doing something like npm install tree-sitter-phpdoc ; ./node_modules/.bin/tree-sitter generate

@claytonrcarter
Copy link
Owner

allows us to generate parsers for arbitrary ABIs

Turns out this is not true. It only supports ABIs 13 and 14, both of which are "newer" than what I can use for my OG use case. Until Atom gets updated tree-sitter support, we either need to make sure that this parser works w/ newer tree-sitter versions, or that it can be downgraded and still work for older versions. Either way, it's a PITA. FWIW, I've just confirmed that this works as-is w/ the the latest tree-sitter: npm i tree-sitter-cli@\* ; ./node_modules/.bin/tree-sitter generate ; ./node_modules/.bin/tree-sitter test. Thanks for your patience and understanding.

fsouza added a commit to fsouza/dotfiles that referenced this issue Apr 10, 2022
Not compatible with Apple Silicon (see
claytonrcarter/tree-sitter-phpdoc#15).
sblask added a commit to sblask/dotfiles that referenced this issue Jun 29, 2022
@anoxia
Copy link

anoxia commented Aug 12, 2022

Quick fix: install tree-sitter-phpdoc under macOS arm chip

Principle: Hack customization of nvim-treesitter.

Note: I use LunarVim, please hack according to your actual situation

Steps:

Go to the nvim-treesitter directory:

cd ~/.local/share/lunarvim/site/pack/packer/start/

Modify the file lua/nvim-treesitter/parsers.lua by referring to the following code

list.phpdoc = {
  install_info = {
-    url = "https://github.com/claytonrcarter/tree-sitter-phpdoc",
+    url = "https://github.com/Anoxia/tree-sitter-phpdoc",
    files = { "src/parser.c", "src/scanner.c" },
    -- parser.c in the repo still based on TS 0.17 due to other dependencies
    requires_generate_from_grammar = true,
    generate_requires_npm = true,
  },
  maintainers = { "@mikehaertl" },
  experimental = true,
}

Modify lockfile.json file

   "phpdoc": {
-    "revision": "46d6366a66266f1e9ae00ee7ea27aa9de629ade6"
+    "revision": "cc4a3da3089e58cf037dc6675b01c41f08143b53"
   },

Finally, reload the nvim configuration, install phpdoc via TSInstall phpdoc, and if the parser.so file fails to move, execute the following command:

cp ~/.local/share/nvim/tree-sitter-phpdoc/parser.so ~/.local/share/lunarvim/site/pack/packer/start/nvim-treesitter/parser/phpdoc.so

enjoy😊!

@oxfist
Copy link

oxfist commented Sep 17, 2022

Came into this great answer and wanted to provide a more general version of the last comment's solution, in case you have installed a regular version of Neovim instead of LunarVim (Neovim vs LunarVim):

1. Go to plugins path

Default Neovim path:

cd ~/.local/share/nvim/site/pack/packer/start/

2. Modify nvim-treesitter/lua/nvim-treesitter/parsers.lua

list.phpdoc = {
  install_info = {
-    url = "https://github.com/claytonrcarter/tree-sitter-phpdoc",
+    url = "https://github.com/Anoxia/tree-sitter-phpdoc",
    files = { "src/parser.c", "src/scanner.c" },
    -- parser.c in the repo still based on TS 0.17 due to other dependencies
    requires_generate_from_grammar = true,
    generate_requires_npm = true,
  },
  maintainers = { "@mikehaertl" },
  experimental = true,
}

3. Modify nvim-treesitter/lockfile.json

   "phpdoc": {
-    "revision": "46d6366a66266f1e9ae00ee7ea27aa9de629ade6"
+    "revision": "cc4a3da3089e58cf037dc6675b01c41f08143b53"
   },

4. Reload Neovim and Install phpdoc

Re-open Neovim to reload configuration, then install parser:

:TSInstall phpdoc

@qRoC
Copy link

qRoC commented Sep 23, 2022

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()

-- Fix `Cannot install tree-sitter-cli for architecture arm64`
parser_config.phpdoc.install_info.url = "https://github.com/Anoxia/tree-sitter-phpdoc"

require("nvim-treesitter.configs").setup {
  ...
}

And remove lockfile.json

@anoxia
Copy link

anoxia commented Sep 26, 2022

Came into this great answer and wanted to provide a more general version of the last comment's solution, in case you have installed a regular version of Neovim instead of LunarVim (Neovim vs LunarVim):

1. Go to plugins path

Default Neovim path:

cd ~/.local/share/nvim/site/pack/packer/start/

2. Modify nvim-treesitter/lua/nvim-treesitter/parsers.lua

list.phpdoc = {
  install_info = {
-    url = "https://github.com/claytonrcarter/tree-sitter-phpdoc",
+    url = "https://github.com/Anoxia/tree-sitter-phpdoc",
    files = { "src/parser.c", "src/scanner.c" },
    -- parser.c in the repo still based on TS 0.17 due to other dependencies
    requires_generate_from_grammar = true,
    generate_requires_npm = true,
  },
  maintainers = { "@mikehaertl" },
  experimental = true,
}

3. Modify nvim-treesitter/lockfile.json

   "phpdoc": {
-    "revision": "46d6366a66266f1e9ae00ee7ea27aa9de629ade6"
+    "revision": "cc4a3da3089e58cf037dc6675b01c41f08143b53"
   },

4. Reload Neovim and Install phpdoc

Re-open Neovim to reload configuration, then install parser:

:TSInstall phpdoc

This path does not exist on my machine:

cd ~/.local/share/nvim/site/pack/packer/start/

@oxfist
Copy link

oxfist commented Sep 26, 2022

@anoxia happy to help if you can provide more information about your setup.

Do you use packer and have tree-sitter installed? Do you have LunarVim installed or regular Neovim?

@anoxia
Copy link

anoxia commented Sep 29, 2022

@anoxia happy to help if you can provide more information about your setup.

Do you use packer and have tree-sitter installed? Do you have LunarVim installed or regular Neovim?

I use LunarVim. Sorry, I thought everyone used LunarVim, so I mistook the path you provided for a problem.

@amitkot
Copy link

amitkot commented Oct 13, 2022

@claytonrcarter would it be possible to include this change in this repo as well?

@claytonrcarter
Copy link
Owner

For those interested (looking at you, @amitkot, and others), please take a look at #23 and let me know if just upgrading to the latest version tree-sitter works for you. Thanks!

claytonrcarter added a commit that referenced this issue Oct 15, 2022
@claytonrcarter
Copy link
Owner

Thank you all for your patience. This repo is using the latest version (at this time) of tree-sitter as of 592429e, so all of this rigamarole should be no longer necessary.

tusktenon added a commit to tusktenon/dotfiles that referenced this issue Nov 1, 2023
There had been an issue where PHPDoc installation failed on Apple
Silicon machines, but it appears to have been resolved.
(claytonrcarter/tree-sitter-phpdoc#15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants