Run Locally Error: ValueError: Path resolution for runtime: nodejs8.10 of binary: npm was not successful
See original GitHub issueDescribe the bug
When clicking “Run Locally” for a NodeJS 8.10 function inside VS Code, I receive the following error:
ValueError: Path resolution for runtime: nodejs8.10 of binary: npm was not successful
To Reproduce
- From terminal,
sam init - Within SAM project directory in VS Code, open hello-world/app.js
- Click the Run Locally button above exports.lambdaHandler
Expected behavior Expect function to run locally without error.
Screenshots
Preparing to run app.lambdaHandler locally... Building SAM Application... Error: sam build encountered an error: 2019-04-23 18:01:20 Building resource 'awsToolkitSamLocalResource' ,Traceback (most recent call last): File "/usr/local/bin/sam", line 11, in <module> load_entry_point('aws-sam-cli==0.15.0', 'console_scripts', 'sam')() File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func return ctx.invoke(f, obj, *args[1:], **kwargs) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/samcli/commands/build/command.py", line 100, in cli skip_pull_image, parameter_overrides, mode) # pragma: no cover File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/samcli/commands/build/command.py", line 141, in do_cli artifacts = builder.build() File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/samcli/lib/build/app_builder.py", line 108, in build lambda_function.runtime) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/samcli/lib/build/app_builder.py", line 199, in _build_function runtime) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/samcli/lib/build/app_builder.py", line 220, in _build_function_in_process mode=self._mode) File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/aws_lambda_builders/builder.py", line 115, in build return workflow.run() File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 48, in wrapper exec_paths = binary_path.resolver.exec_paths if not binary_path.path_provided else binary_path.binary_path File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/aws_lambda_builders/path_resolver.py", line 29, in exec_paths return self._which() File "/usr/local/Cellar/aws-sam-cli/0.15.0/libexec/lib/python3.7/site-packages/aws_lambda_builders/path_resolver.py", line 24, in _which "{} was not successful".format(self.runtime, self.binary)) ValueError: Path resolution for runtime: nodejs8.10 of binary: npm was not successful
Desktop: VS Code version 1.33.1 2. Node version 8.10.0 3. SAM CLI version 0.15.0 4. AWS Toolkit for VS Code v0.1.1 5. Mac Sierra 10.12.6
Additional context
It’s worth noting that if I open a terminal, navigate to project directory, and run the command below, the local test works as expected:
sam local invoke "HelloWorldFunction" -e event.json
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
Hi @matwerber1 , do you typically open VS Code from the Application Tray? If so, can you please try launching VS Code from the same terminal that you have success running
sam local invokefrom? I’d like to know if it that succeeds.Would you also be able to provide:
which npm)SHELLenvironment variable (echo $SHELL)If this is still an issue in the latest Toolkit please open a new issue. Thanks!