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

"Permission denied" on install #94

Closed
vegarab opened this issue Aug 11, 2017 · 12 comments
Closed

"Permission denied" on install #94

vegarab opened this issue Aug 11, 2017 · 12 comments

Comments

@vegarab
Copy link

vegarab commented Aug 11, 2017

Attempting install with sudo, and as root (sudo -i) results in "permission denied" errors:

root@kde-desktop:~# npm install -g fb-messenger-cli
npm WARN deprecated crypto@0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
/usr/bin/fb-messenger-cli -> /usr/lib/node_modules/fb-messenger-cli/cli.js

> phantomjs-prebuilt@2.1.14 install /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt
> node install.js

Considering PhantomJS found at /usr/local/bin/phantomjs
Found PhantomJS at /usr/local/bin/phantomjs ...verifying
Writing location.js file
Error checking path, continuing { Error: EACCES: permission denied, open '/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/location.js'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at writeLocationFile (/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/util.js:84:6)
    at Promise._successFn (/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/install.js:375:11)
    at nextTickCallback (/usr/lib/node_modules/fb-messenger-cli/node_modules/kew/kew.js:47:28)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/location.js' }
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1502463736395/phantomjs-2.1.1-linux-x86_64 -> /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1502463736395/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom'
  errno: -13,
  code: 'EACCES',
  syscall: 'link',
  path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1502463736395/phantomjs-2.1.1-linux-x86_64',
  dest: '/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1502463736395/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-08-11T15_02_19_574Z-debug.log

@sarangjo
Copy link
Contributor

@vegarab It looks like there's an issue with your PhantomJS installation under /usr/local/bin/phantomjs. Maybe try deleting that and retrying the install?

@romainrichard
Copy link

romainrichard commented Sep 29, 2017

I got it to work by adding --unsafe-perm (I'm not familiar with npm so I'm not sure if that's something we should be doing, but it works):

$ sudo npm install -g fb-messenger-cli --unsafe-perm
/usr/bin/fb-messenger-cli -> /usr/lib/node_modules/fb-messenger-cli/cli.js

> phantomjs-prebuilt@2.1.15 install /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1506668202090/phantomjs-2.1.1-linux-x86_64 -> /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /usr/lib/node_modules/fb-messenger-cli/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
+ fb-messenger-cli@1.8.1
added 159 packages in 7.365s

@danielreyes61
Copy link

I'm having the same issue, --unsafe-perm and deleting phantomjs dir did not fix it. Still not able to install but really want to use this.

@SamBergeron
Copy link
Collaborator

I'm looking at updating the headless client to something simpler than phantomJS as it seems to not work perfectly for everyone. Sorry that this is making some people's experience pretty shitty. In the mean time, I'll point people to this thread as it has the most amount of info.

@Qualitymix
Copy link

Ooo, if you're looking at using a replacement for phantomjs, might I request that it be something that is friendly with ARM? phantomjs has to be built manually, which on some arm chips, takes days.

@jsmith037982374
Copy link

@danielreyes61 I got it to work by running noth --unsafe-perm and --ignore-scripts at the same time. Did you try both or just the first?

@2E0PGS
Copy link

2E0PGS commented Dec 30, 2017

@romainrichard fix worked for me on Ubuntu 16.04: sudo npm install -g fb-messenger-cli --unsafe-perm

@leondzn
Copy link

leondzn commented Feb 2, 2018

This is an npm issue. I managed to make mine working by switching my npm prefix (default home directory) to my home directory

mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'

Then I added the new default directory to the PATH environment variable so the commands can be seen by bash:
export PATH=$PATH:~/.npm-global

Then after either restarting bash or updating the system variables with
source ~/.bashrc

I reinstalled fb-messenger-cli without sudo and it installs fine.

Using --unsafe-perm switch makes me a bit uneasy. lmao

Source

@SamBergeron
Copy link
Collaborator

Hopefully the fact that we aren't using PhantomJS anymore fixed this. Puppeteer is not a pre-built module and shouldn't cause this issue. Hopefully this makes installation life much easier

@gusano
Copy link
Contributor

gusano commented Feb 2, 2018

@SamBergeron I can confirm that by properly setting npm prefix it works out the box without using sudo with master branch on my arch linux machine.

@quinncomendant
Copy link

I had this error. It was because the server didn't have bzip2 installed. After sudo yum install bzip2, it installed successfully.

@j-hui
Copy link

j-hui commented Feb 24, 2020

@leondzn that worked except the PATH needed to point to bin for me:

export PATH=$PATH:~/.npm-global/bin

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

No branches or pull requests