-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
stage/waiting-for-releaseFix has been merged to develop and is waiting for a releaseFix has been merged to develop and is waiting for a releasetype/bug
Description
Description:
sam build is failing when using npm v9.1.2. When I run with the --debug option, I see:
...
executing NPM: ['npm', 'bin']
Exception raised during the execution
...
Looking through the npm changelog, I found that the bin command was removed in 9.0.0-pre.0. So it looks like SAM CLI will need to call npm some other way when building nodejs/esbuild projects.
Steps to reproduce:
npm install -g npm@9.1.2to get the latest npm versionsam --inita TypeScript project using esbuild- Run
sam buildin that project
Observed result:
sam build fails with the following traceback:
Traceback (most recent call last):
File "samcli/__main__.py", line 12, in <module>
File "click/core.py", line 1130, in __call__
File "click/core.py", line 1055, in main
File "click/core.py", line 1657, in invoke
File "click/core.py", line 1404, in invoke
File "click/core.py", line 760, in invoke
File "click/decorators.py", line 84, in new_func
File "click/core.py", line 760, in invoke
File "samcli/lib/telemetry/metric.py", line 194, in wrapped
File "samcli/lib/telemetry/metric.py", line 140, in wrapped
File "samcli/lib/utils/version_checker.py", line 41, in wrapped
File "samcli/cli/main.py", line 86, in wrapper
File "samcli/commands/build/command.py", line 206, in cli
File "samcli/commands/build/command.py", line 276, in do_cli
File "samcli/commands/build/build_context.py", line 256, in run
File "samcli/lib/build/app_builder.py", line 210, in build
File "samcli/lib/build/build_strategy.py", line 393, in build
File "samcli/lib/build/build_strategy.py", line 80, in build
File "samcli/lib/build/build_strategy.py", line 400, in _build_functions
File "samcli/lib/build/build_strategy.py", line 415, in _run_builds_async
File "samcli/lib/utils/async_utils.py", line 131, in run_async
File "samcli/lib/utils/async_utils.py", line 90, in run_given_tasks_async
File "asyncio/base_events.py", line 587, in run_until_complete
File "samcli/lib/utils/async_utils.py", line 58, in _run_given_tasks_async
File "concurrent/futures/thread.py", line 57, in run
File "samcli/lib/build/build_strategy.py", line 426, in build_single_function_definition
File "samcli/lib/build/build_strategy.py", line 174, in build_single_function_definition
File "samcli/lib/build/app_builder.py", line 705, in _build_function
File "samcli/lib/build/app_builder.py", line 859, in _build_function_in_process
File "aws_lambda_builders/builder.py", line 161, in build
File "aws_lambda_builders/workflows/nodejs_npm_esbuild/workflow.py", line 56, in __init__
File "aws_lambda_builders/workflows/nodejs_npm_esbuild/workflow.py", line 218, in _get_esbuild_subprocess
File "aws_lambda_builders/workflows/nodejs_npm/npm.py", line 85, in run
aws_lambda_builders.workflows.nodejs_npm.npm.NpmExecutionError: NPM Failed:
[7311] Failed to execute script __main__
Expected result:
sam build would work as normal.
Additional environment details
- OS: Windows 11 Pro (in a WSL2 devcontainer)
sam --version: 1.65.0
Metadata
Metadata
Assignees
Labels
stage/waiting-for-releaseFix has been merged to develop and is waiting for a releaseFix has been merged to develop and is waiting for a releasetype/bug