SamVerschueren / alfred-link

Make your Alfred workflows installable from npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install error with alfred-npms

alexreg opened this issue · 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
> alfred-npms@2.1.0 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! alfred-npms@2.1.0 postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the alfred-npms@2.1.0 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 sindresorhus/alfred-npms#25

(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: #20 (comment)

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

Which alfred version do you use?

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.

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?

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

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

commented

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

> alfred-figma@0.3.0 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! alfred-figma@0.3.0 postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alfred-figma@0.3.0 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

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

> alfred-outline@1.0.0-1 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! alfred-outline@1.0.0-1 postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the alfred-outline@1.0.0-1 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

How to work? I got the same error

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

> fast-xml-parser@3.17.4 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/alfred-jetbrains@1.4.0 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/alfred-jetbrains@1.4.0 postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @bchatard/alfred-jetbrains@1.4.0 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