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

Can't install any plugins if node is installed inside a folder with a space on Windows #4987

Closed
nelsyeung opened this issue Apr 20, 2024 · 2 comments · Fixed by #4988
Closed

Comments

@nelsyeung
Copy link

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9010312
node version: v18.20.2
coc.nvim version: 0.0.82-'77ae2d43 2024-04-19 18:15:40 +0800'
coc.nvim directory: C:\Users\nelsy\vimfiles\pack\plugins\start\coc.nvim
term: undefined
platform: win32

## Log of coc.nvim

2024-04-20T12:15:48.719 INFO (pid:26160) [configurations] - Add folder configuration from cwd: C:\Users\nelsy\vimfiles\pack\plugins\start\coc.nvim\.vim\coc-settings.json
2024-04-20T12:15:49.266 INFO (pid:26160) [plugin] - coc.nvim initialized with node: v18.20.2 after 599
2024-04-20T12:15:49.276 INFO (pid:26160) [attach] - receive notification: highlight []
2024-04-20T12:15:49.474 INFO (pid:26160) [extension-installer] - Fetched info of coc-yaml {
  'dist.tarball': 'https://registry.npmjs.org/coc-yaml/-/coc-yaml-1.9.0.tgz',
  'engines.coc': '^0.0.80',
  version: '1.9.0',
  name: 'coc-yaml'
}
2024-04-20T12:15:49.625 INFO (pid:26160) [model-download] - Download completed: URL {
  href: 'https://registry.npmjs.org/coc-yaml/-/coc-yaml-1.9.0.tgz',
  origin: 'https://registry.npmjs.org',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'registry.npmjs.org',
  hostname: 'registry.npmjs.org',
  port: '',
  pathname: '/coc-yaml/-/coc-yaml-1.9.0.tgz',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}
2024-04-20T12:15:49.631 INFO (pid:26160) [model-download] - Downloaded https://registry.npmjs.org/coc-yaml/-/coc-yaml-1.9.0.tgz => C:\Users\nelsy\AppData\Local\coc\extensions\node_modules\coc-yaml-0c09eda6-00eb-405f-94fe-0b61adff2f16
2024-04-20T12:15:49.763 ERROR (pid:26160) [extensions-index] - Error on install coc-yaml Error: C:\Program Files\nodejs\npm.CMD install exited with 1
    at ChildProcess.<anonymous> (C:\Users\nelsy\vimfiles\pack\plugins\start\coc.nvim\build\index.js:67452:22)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
2024-04-20T12:15:52.228 INFO (pid:26160) [attach] - receive notification: highlight []
2024-04-20T12:16:23.126 INFO (pid:26160) [attach] - receive notification: highlight []
2024-04-20T12:16:23.265 INFO (pid:26160) [attach] - receive notification: highlight []
2024-04-20T12:16:23.983 INFO (pid:26160) [attach] - receive notification: highlight []
2024-04-20T12:16:28.057 INFO (pid:26160) [attach] - receive notification: showInfo []

Describe the bug

Can't install any plugins with node is installed inside a folder with a space (e.g., C:\Program Files\nodejs\node.CMD

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't
reproduce it

  • Create file mini.vim with:

    set nocompatible
    set runtimepath^=~/vimfiles/pack/plugins/start/coc.nvim
    filetype plugin indent on
    syntax on
    set hidden
    let g:coc_global_extensions = ['coc-yaml']
  • Start (neo)vim with command: vim -u mini.vim

  • Operate vim.

Extra info

According to https://stackoverflow.com/a/30893153/2687427 you cannot use the full path for child_process.spawn.

For now, I have hacked in "npm.CMD" instead of this.npm to allow this to work:

const child = child_process.spawn(this.npm, args, {
src/extension/install.ts

fannheyward added a commit that referenced this issue Apr 22, 2024
Closes #4987

on windows, command should be quoted if containing spaces. nodejs/node#7367
@fannheyward
Copy link
Member

Can you try this fix #4988 ?

@nelsyeung nelsyeung changed the title Can't install any plugins if node is installed inside a folder with a space on Windowsk Can't install any plugins if node is installed inside a folder with a space on Windows Apr 22, 2024
@nelsyeung
Copy link
Author

@fannheyward It works! Thanks :)

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.

2 participants