Tim-B / grunt-aws-lambda

A grunt plugin to assist in developing functions for AWS Lambda.
MIT License
247 stars 100 forks source link

Task "lambda_package" not found. #22

Closed jasonfreier closed 8 years ago

jasonfreier commented 9 years ago

After uninstalling and reinstalling dependencies and grunt-aws-lambda 0.8.0, packaging no longer works for me. Prior to this version it was working even with the default empty lambda_package setting in Gruntfile.js.

Grunt 0.4.5 Grunt-Cli 0.1.13 Grunt-aws-lambda 0.8.0

Tim-B commented 9 years ago

Could you post your Gruntfile.js and package.json? That might help determine whether it's an implementation issue or an issue with the actual plugin.

jasonfreier commented 9 years ago

Sure thing, pretty basic content.

I've attached both for your review. It seems that part of it is that grunt-cli changed to have deploy be the alias for both package and deploy. Also, even running grunt --help I get errors with "Loading 'Lambda_package.js' tasks..." Looks like it might be having an issue not finding npm as well.

Gruntfile.js

var grunt = require('grunt');
grunt.loadNpmTasks('grunt-aws-lambda');

grunt.initConfig({
    lambda_invoke: {
        default: {
          options: {
            file_name: 'index.js'
          }

        }
    },

lambda_package: {
        default: {
            options: {

            }
        }
    },
});

grunt.registerTask('deploy', ['lambda_package', 'lambda_deploy']);

package.json

{
  "name": "MyLambdaFunction",
  "version": "2.1.0",
  "description": "Description goes here.",
  "main": "index.js",
  "private": "true",
  "dependencies": {
    "aws-sdk": "latest",
    "json-bignum": "^0.0.3",
    "moment": "^2.9.0"
  },
  "devDependencies": {
    "aws-sdk": "latest",
    "grunt": "0.4.*",
    "grunt-pack": "0.1.*",
    "grunt-aws-lambda": "0.1.*",
    "npm": "^2.8.3"

  },
  "bundledDependencies": [
    "json-bignum",
    "moment"
  ]
}
Tim-B commented 9 years ago

I think "grunt-aws-lambda": "0.1.*", should be "grunt-aws-lambda": "0.8.0", (or another version declaration which 0.8.0 would satisfy) in your package.json.

timdp commented 9 years ago

The issue not finding npm sounds a lot like #20. That one would result in the same sort of errors for me.

goliatone commented 9 years ago

This issue happens because the task is failing due to an error. It's looking for the npm package and is not found. If you do npm i npm --save-dev it should fix the issue.

jasonfreier commented 9 years ago

That would be great if I was on a Linux system, but I’m on windows…and end up with a bunch of nested directories that are almost impossible to get rid of.

From: goliatone [mailto:notifications@github.com] Sent: Wednesday, July 29, 2015 4:56 PM To: Tim-B/grunt-aws-lambda grunt-aws-lambda@noreply.github.com Cc: Jason Freier jason.freier@nativex.com Subject: Re: [grunt-aws-lambda] Task "lambda_package" not found. (#22)

This issue happens because the task is failing due to an error. It's looking for the npm package and is not found. If you do npm i npm --save-dev it should fix the issue.

— Reply to this email directly or view it on GitHubhttps://github.com/Tim-B/grunt-aws-lambda/issues/22#issuecomment-126108158.

timdp commented 9 years ago

@jasonfreier You can upgrade to npm 3, which flattens dependency structures, by running npm i -g npm@3.2.0. Be aware that you'll still need npm 2 as a dependency of grunt-aws-lambda because of #28. (Installing npm 2 locally with a global npm 3 works just fine.)