Skip to content

SAM build with --manifest don't recognize the package.json #4427

@Maoragai12

Description

@Maoragai12

Description:

When I try to build a Lambda function with the --manifest to locate the package.json, it throws an error:

ENOENT: no such file or directory, open '/private/var/folders/cf/ggmwqfwn03q443mj6vzryn0c0000gr/T/tmpch3vnyji/package.json'

Steps to reproduce:

Run the following command:

"sam build --manifest ./package.json --template services/expenses-service/template.yaml --parameter-overrides EnvType={args.EnvType} --beta-features --build-dir=.aws-sam/build/expenses-service --debug"

Observed result:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/aws-sam-cli/1.65.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/workflow.py", line 301, in run
    action.execute()
  File "/opt/homebrew/Cellar/aws-sam-cli/1.65.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/workflows/nodejs_npm/actions.py", line 114, in execute
    raise ActionFailedError(str(ex))
aws_lambda_builders.actions.ActionFailedError: NPM Failed: npm WARN config production Use `--omit=dev` instead.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /private/var/folders/cf/ggmwqfwn03q443mj6vzryn0c0000gr/T/tmpsxb76scf/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/private/var/folders/cf/ggmwqfwn03q443mj6vzryn0c0000gr/T/tmpsxb76scf/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:

Build Failed

Expected result:

Take the package.json from the specified location and build the Lambda.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS Monterey V12.5.1
  2. sam --version: SAM CLI, version 1.65.0
  3. AWS region: us-east-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked/close-if-inactiveBlocked for >14 days with no response, will be closed if still inactive after 7 daysblocked/more-info-neededMore info is needed from the requester. If no response in 14 days, it will become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions