In Alfred, type npm, Enter, and your query, to search for packages.
Select a package and press Enter to go to its GitHub repo.
Hold Alt when pressing Enter to go to its npm page.
Hold Ctrl when pressing Enter to copy the package name to the clipboard.
Press Command to display additional information.
Press Shift to view its readme in Quick Look.
The search is made with boost-exact:false by default. You may pass any npms.io operators.
Would be great if you would bundle it to a single workflow file. I use NVM and don't want to add alfred workflows in every version. This would get messy at some point.
Not sure if this is an issue with the alfred-link package, but it fails to find my user's Alfred preference files when install run as "sudo". However, on OS X to install packages globally, you must run as "sudo".
Here is the original NPM error:
[Error: Alfred preferences not found at location /Users/username/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist]
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "https://github.com/sindresorhus/alfred-npms.git"
npm ERR! node v5.7.0
npm ERR! npm v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: alfred-link
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'alfred-link'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the alfred-npms package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! alfred-link
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs alfred-npms
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls alfred-npms
npm ERR! There is likely additional logging output above.
I confirmed the preferences plist is there at the path referenced above. I cloned the repo into the global folder at /usr/local/lib/node_modules and then did removed the post install script command, and did the "npm install -g" as sudo. Then I could manually run "alfred-link" in the directory (I had installed alfred-link globally via npm first).
I'm looking to see if you can publish this module into npm as I have just recently developed this app which is made to be compatible with existing alfy workflows. Right now it works with my own alfy module but would like to see if become fully compatible with other alfy modules.
$ 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
This is a great workflow! The only issue for me is syncing across different machines since I'd like to use this on both my work and personal computers. From the Alfred docs, I've set up dropbox to keep my workflows consistent but installing this on one machine removes it from the other.
"items": [
{
"title": "RequestError: read ECONNRESET",
"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
"valid": false,
"text": {
"copy": "```\nRequestError: read ECONNRESET\n at ClientRequest.<anonymous> (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/got/dist/source/core/index.js:962:111)\n at ClientRequest.origin.emit (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n```\n\n-\nnpms 3.0.0\nAlfred 4.6.2\ndarwin 21.2.0",
"largetype": "RequestError: read ECONNRESET\n at ClientRequest.<anonymous> (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/got/dist/source/core/index.js:962:111)\n at ClientRequest.origin.emit (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)"
},
"icon": {
"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
}
}
]
I found this issue comment, request/request-promise#147 (comment), and I added Connection: 'keep-alive' header to alfred-npms/node_modules/alfy/index.js:137 then the error has been resolved.
We are using an enterprise registry served by https://github.com/cnpm/cnpmjs.org, and the API is compatable to npmjs.org. I want to use this workflow to search from our registry, but the result is different.
but any typing after that turns into a "normal" alfred search
I went into the workflow debugger and noticed the following debug output with each keystroke
Starting debug for 'npms'
[2016-06-27 09:42:47][ERROR: input.scriptfilter] Code 127: bash: cannot set terminal process group (18927): Inappropriate ioctl for device
bash: no job control in this shell
/Users/jschulz/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Scripts/BAA37249-3FCB-4A17-8851-29707885B376: line 9: node: command not found
node is installed. I'm assuming that's a cascading failure originating from the cannot set terminal process group error.
Let me know if I can do anything else to help debug or fix.
when I install alfred-npms , the npm raise an error
Error: Permission denied to read Alfred preferences at location /Users/manjusaka/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n
npm install --global alfred-npms
>[email protected] postinstall /usr/local/lib/node_modules/alfred-npms
> alfy-init
{ Error: Command failed: alfred-link
Error: Workflow directory `/Users/dubba/repos/dotfiles-macbook-pro/alfred/Alfred.alfredpreferences/workflows` does not exist
at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/alfred-link/index.js:19:10)
at <anonymous>
at Promise.all.then.arr (/usr/local/lib/node_modules/alfred-npms/node_modules/execa/index.js:201:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
code: 1,
killed: false,
stdout: '',
stderr: 'Error: Workflow directory `/Users/dubba/repos/dotfiles-macbook-pro/alfred/Alfred.alfredpreferences/workflows` does not exist\n at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/alfred-link/index.js:19:10)\n at <anonymous>\n',
failed: true,
signal: null,
cmd: 'alfred-link',
timedOut: 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! /Users/dubba/.npm/_logs/2018-04-12T19_01_01_940Z-debug.log