Alex-Rose / fb-messenger-cli

fb-messenger-cli, console Facebook messenger
761 stars 99 forks source link

Attempting to write to usr/lib when launched for non-sudo user. #189

Open Weaselgrease opened 5 years ago

Weaselgrease commented 5 years ago

Program launched for local user in their home directory after installing there, but fails to save because it's saving to the /usr/lib/ directory. There's no reason to elevate to root privileges for a script like this. Over-all it sounds like a pretty easy fix.

[weasel@ArchGrease ~]$ mkdir .node && cd .node
[weasel@ArchGrease .node]$ npm install fb-messenger-cli

> puppeteer@1.10.0 install /home/weasel/.node/node_modules/puppeteer
> node install.js

npm WARN saveError ENOENT: no such file or directory, open '/home/weasel/.node/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/weasel/.node/package.json'
npm WARN .node No description
npm WARN .node No repository field.
npm WARN .node No README data
npm WARN .node No license field.

+ fb-messenger-cli@2.1.1
added 143 packages from 185 contributors and audited 254 packages in 4.708s
found 0 vulnerabilities
[weasel@ArchGrease lib]$ fb-messenger-cli
Login verification failed: Warning: Settings not found, saving default values
Facebook credentials:
Email: 
Password:
Attempting login...
Fetching login cookie
Login verification failed: No saved profile, please login
Facebook credentials:
Email:
Password:
Attempting login...
Fetching login cookie
Error saving .settings file: Error: EACCES: permission denied, open '/usr/lib/node_modules/fb-messenger-cli/.settings'
Thanks for using fb-messenger-cli
Bye!
[weasel@ArchGrease lib]$
aearil commented 5 years ago

Agreed, to store things like .settings the program should use $XDG_CONFIG_HOME when launched by a normal user.

reece146 commented 4 years ago

Has there been a regression on this? I am trying to run as a non-root user and this issue is still occurring. The app is ignoring XDG_CONFIG_HOME.

Error saving .settings file: Error: EACCES: permission denied, open '/usr/local/lib/node_modules/fb-messenger-cli/.settings'

fb-messenger-cli cloned today (2.1.1), nodejs-8.10, npm-3.5.2, elementary Linux 5.1.2 (Ubuntu 18.04.4 LTS)