[NPMCLI-146] problem to install tab-completition Created: 17/Nov/17  Updated: 17/Nov/17  Resolved: 17/Nov/17

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: 2.1.0
Fix Version/s: 2.2.0

Type: Bug Priority: Neutral
Reporter: Tomáš Gregovský Assignee: Federico Grilli
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Documentation update required:
Yes
Date of First Response:
Sprint: Basel 122
Story Points: 1

 Description   

I have installed CLI since beginning, so I am doing just updated to latest versions. At some point tab-completition stopped working. I tried to update to latest version today and install tab-completion again, here is what I got in terminal:

tomas ~ $ mgnl tab-completion install
ERR! Failed to set up tab completion due to missing write permissions in:
ERR! 
ERR!   - /etc/bash_completion.d
ERR!   - /Users/tomas/.mgnl
ERR! 
ERR! Did you run installation as root? If so, you'd need to add the flag --unsafe-perm, but that's not recommended for security reasons.
ERR! Tab autocompletion could not be installed, since none of typical related directories or files were found and accessible.


tomas ~ $ sudo mgnl tab-completion install --unsafe-perm
Password:

  error: unknown option `--unsafe-perm'


tomas ~ $ sudo mgnl tab-completion install
ERR! Failed to set up tab completion due to missing write permissions in:
ERR! 
ERR!   - /etc/bash_completion.d
ERR!   - /Users/tomas/.mgnl
ERR! 
ERR! Did you run installation as root? If so, you'd need to add the flag --unsafe-perm, but that's not recommended for security reasons.
ERR! Tab autocompletion could not be installed, since none of typical related directories or files were found and accessible.

I don't have "source /usr/local/lib/node_modules/@magnolia/cli/extra/mgnl-autocompletion.sh" in my .profile

Any idea? thanks!



 Comments   
Comment by Federico Grilli [ 17/Nov/17 ]

That seems to make no sense but apparently tomas doesn't have write permissions on his own home directory. What mgnl tab-completion install does is to try to install the autocomplete script first globally then, should that fails, in the user home dir. To do that, it first checks fs.accessSync(os.homedir(), fs.constants.W_OK) and that's where it fails in your case.
I did a fresh install (2.2.0-snapshot, first removed old version) just yesterday including tab completion and it worked fine.

Comment by Federico Grilli [ 17/Nov/17 ]

tgregovsky what's your Node version? Mine is v6.10.2

Comment by Tomáš Gregovský [ 17/Nov/17 ]

Hi fgrilli thank you for your help, my node version is v6.2.0
and ok I will try to update node, uninstall and install again cli and see if it helps...

Comment by Federico Grilli [ 17/Nov/17 ]

Turned out to be an issue with Node version 6.2.

node > fs.constants.W_OK

will throw an error as constants is undefined, hence the failure.
However, we recommend and actually enforce having Node >= 6.0 which is clearly not enough. Let's thus raise minimum Node.js >=6.10.

Generated at Mon Feb 12 04:46:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.