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

Cannot read property 'alfy' of undefined #52

Open
IAIAE opened this issue Jun 3, 2017 · 3 comments
Open

Cannot read property 'alfy' of undefined #52

IAIAE opened this issue Jun 3, 2017 · 3 comments

Comments

@IAIAE
Copy link

IAIAE commented Jun 3, 2017

the index.js is

const alfy = require('alfy');
alfy.output([{
title: 'Unicorn'
}, {
title: 'Rainbow'
}]);

and the console outputs the error:

[ERROR: input.scriptfilter] Code 1: {
  "items": [
    {
      "title": "Unicorn"
    },
    {
      "title": "Rainbow"
    }
  ]
}
{
  "items": [
    {
      "title": "TypeError: Cannot read property 'alfy' of undefined\n    at readPkgUp.then.result (/Users/pro/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.0408C61C-45B8-474D-B77D-B3C6691E4024/node_modules/alfy/lib/update-notification.js:7:26)",
      "subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
      "valid": false,
      "text": {
        "copy": "```\nTypeError: Cannot read property 'alfy' of undefined\n    at readPkgUp.then.result (/Users/pro/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.0408C61C-45B8-474D-B77D-B3C6691E4024/node_modules/alfy/lib/update-notification.js:7:26)\n```\n\n-\nregurl undefined\nAlfred 3.3.2\ndarwin x64 15.6.0",
        "largetype": "TypeError: Cannot read property 'alfy' of undefined\n    at readPkgUp.then.result (/Users/pro/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.0408C61C-45B8-474D-B77D-B3C6691E4024/node_modules/alfy/lib/update-notification.js:7:26)"
      },
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      }
    }
  ]
}
[2017-06-03 16:11:59][ERROR: input.scriptfilter] JSON error: Garbage at end. in JSON:
{
  "items": [
    {
      "title": "Unicorn"
    },
    {
      "title": "Rainbow"
    }
  ]
}
{
  "items": [
    {
      "title": "TypeError: Cannot read property 'alfy' of undefined\n    at readPkgUp.then.result (/Users/pro/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.0408C61C-45B8-474D-B77D-B3C6691E4024/node_modules/alfy/lib/update-notification.js:7:26)",
      "subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
      "valid": false,
      "text": {
        "copy": "```\nTypeError: Cannot read property 'alfy' of undefined\n    at readPkgUp.then.result (/Users/pro/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.0408C61C-45B8-474D-B77D-B3C6691E4024/node_modules/alfy/lib/update-notification.js:7:26)\n```\n\n-\nregurl undefined\nAlfred 3.3.2\ndarwin x64 15.6.0",
        "largetype": "TypeError: Cannot read property 'alfy' of undefined\n    at readPkgUp.then.result (/Users/pro/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.0408C61C-45B8-474D-B77D-B3C6691E4024/node_modules/alfy/lib/update-notification.js:7:26)"
      },
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      }
    }
  ]
}
@SamVerschueren
Copy link
Collaborator

Do you have a package.json file in your project directory? It looks like it can't find it.

@GeorgeMSchaffer
Copy link

I just got that error when going through the steps for example workflow in the readme.rd file. Based on Sam's comment I ran 'npm init' and it works now.

@SamVerschueren
Copy link
Collaborator

Exactly, you need a package.json file. I will have a look if I can make the error message more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants