alfred-link icon indicating copy to clipboard operation
alfred-link copied to clipboard

Install error with alfred-npms

Open alexreg opened this issue 6 years ago • 10 comments

What's going on here?

I kind of suspect this is similar to #7, but rather than running as root, it's running as the special _homebrew user (I use brewdo). It needs to be run by brewdo because node modules are in /usr/local/lib/node_modules, which is owned by _homebrew rather than any particular user. This module should probably have a manual post-install step to be run for each user on their Alfred settings.

$ npm --global install alfred-npms
> [email protected] postinstall /usr/local/lib/node_modules/alfred-npms
> alfy-init

{ Error: Command failed: alfred-link
Error: Alfred preferences not found at location /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist
    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/resolve-alfred-prefs/index.js:15:10)


    at makeError (/usr/local/lib/node_modules/alfred-npms/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/usr/local/lib/node_modules/alfred-npms/node_modules/execa/index.js:278:16)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
  code: 1,
  stdout: '',
  stderr:
   'Error: Alfred preferences not found at location /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/resolve-alfred-prefs/index.js:15:10)\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false,
  killed: false }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall 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!     /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/.npm/_logs/2019-02-23T03_35_58_148Z-debug.log

CC https://github.com/sindresorhus/alfred-npms/issues/25

alexreg avatar Feb 23 '19 20:02 alexreg

(Sorry deleted my previous comment because I thought I found a fix, but I was wrong)

Also having this issue now, since I don't have my Alfred preferences synced in the default location: https://github.com/SamVerschueren/alfred-link/pull/20#issuecomment-472024948

megaroeny avatar Mar 12 '19 14:03 megaroeny

I have mine in the default location (the cause seems to be the above), but useful to know there are multiple causes.

alexreg avatar Mar 12 '19 16:03 alexreg

Which alfred version do you use?

SamVerschueren avatar Aug 29 '19 05:08 SamVerschueren

This surely occurred using Alfred 3, since v4 wasn't out back when I reported it. That said, I just tested on v4, and the identical issue occurs.

alexreg avatar Aug 29 '19 18:08 alexreg

It's weird that it tries to look for the Alfred.preferences file in this folder /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist. Or is that the location you picked in the Alfred settings?

SamVerschueren avatar Aug 30 '19 07:08 SamVerschueren

Nope, it's not. Presumably this is an issue caused by interaction with brew and its temporary HOME env var.

alexreg avatar Aug 31 '19 20:08 alexreg

Hello, I have the same issue with Travis builds using Node.js v10.16.3. I have same version of node installed locally on macOS and it works fine.

Failing build Node.js v10.16.3 https://travis-ci.org/skibitsky/alfred-timing/jobs/593542787

Successful build Node.js v8.16.1 https://travis-ci.org/skibitsky/alfred-timing/jobs/593542788

skibitsky avatar Oct 04 '19 14:10 skibitsky

Same issue over here Not sure if it's related to the Alfred Preferences being in a shared folder on Dropbox.

> [email protected] postinstall /usr/local/lib/node_modules/alfred-figma
> alfy-init

Error: Command failed: alfred-link
Error: Permission denied to read Alfred preferences at location /var/root/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist
    at module.exports (/usr/local/lib/node_modules/alfred-figma/node_modules/resolve-alfred-prefs/index.js:44:9)


    at makeError (/usr/local/lib/node_modules/alfred-figma/node_modules/execa/index.js:174:9)
    at /usr/local/lib/node_modules/alfred-figma/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  code: 1,
  stdout: '',
  stderr: 'Error: Permission denied to read Alfred preferences at location /var/root/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n' +
    '    at module.exports (/usr/local/lib/node_modules/alfred-figma/node_modules/resolve-alfred-prefs/index.js:44:9)\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false,
  killed: false
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall 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!     /var/root/.npm/_logs/2019-10-16T11_38_10_395Z-debug.log

MrBeardedGuy avatar Oct 16 '19 11:10 MrBeardedGuy

I have the exact same issue here trying to install alfred-outline npm install --global alfred-outline

> [email protected] postinstall /usr/local/lib/node_modules/alfred-outline
> alfy-init

Error: Command failed with exit code 1 (EPERM): alfred-link
    at makeError (/usr/local/lib/node_modules/alfred-outline/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/usr/local/lib/node_modules/alfred-outline/node_modules/execa/index.js:112:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /usr/local/lib/node_modules/alfred-outline/node_modules/alfy/init.js:7:3 {
  command: 'alfred-link',
  exitCode: 1,
  exitCodeName: 'EPERM',
  stdout: '',
  stderr: 'Error: Permission denied to read Alfred preferences at location /Users/carstenandersen/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n' +
    '    at module.exports (/usr/local/lib/node_modules/alfred-outline/node_modules/resolve-alfred-prefs/index.js:44:9)',
  all: 'Error: Permission denied to read Alfred preferences at location /Users/carstenandersen/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n' +
    '    at module.exports (/usr/local/lib/node_modules/alfred-outline/node_modules/resolve-alfred-prefs/index.js:44:9)',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  signal: undefined
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall 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!     /Users/carstenandersen/.npm/_logs/2020-07-21T12_07_22_362Z-debug.log

Curzey avatar Jul 21 '20 12:07 Curzey

How to work? I got the same error

Franks-MacBook-Pro-2:~ frankbian$ sudo npm install -g @bchatard/alfred-jetbrains

> [email protected] postinstall /usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/fast-xml-parser
> node tasks/postinstall.js || exit 0

Love fast-xml-parser? Check https://amitkumargupta.work for more projects and contribution.


> @bchatard/[email protected] postinstall /usr/local/lib/node_modules/@bchatard/alfred-jetbrains
> alfy-init

Error: Command failed with exit code 1 (EPERM): alfred-link
    at makeError (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/alfy/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/alfy/node_modules/execa/index.js:112:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/alfy/init.js:7:3 {
  command: 'alfred-link',
  exitCode: 1,
  exitCodeName: 'EPERM',
  stdout: '',
  stderr: 'Error: Permission denied to read Alfred preferences at location /Users/frankbian/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n' +
    '    at module.exports (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/resolve-alfred-prefs/index.js:44:9)',
  all: 'Error: Permission denied to read Alfred preferences at location /Users/frankbian/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n' +
    '    at module.exports (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/resolve-alfred-prefs/index.js:44:9)',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  signal: undefined
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @bchatard/[email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @bchatard/[email protected] postinstall 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!     /Users/frankbian/.npm/_logs/2020-11-03T10_00_45_867Z-debug.log

FrankBian avatar Nov 03 '20 10:11 FrankBian