DEV Community

Cover image for Quick Fix: AWS SAM Error: NodejsNpmBuilder:NpmPack
AsmaTheWizard
AsmaTheWizard

Posted on

Quick Fix: AWS SAM Error: NodejsNpmBuilder:NpmPack

I was running my lambda functions locally using AWS SAM framework, Everything was working fine until I did some change to YAML file. After that, I couldn't build the project! It will show this error message

Error: NodejsNpmBuilder:NpmPack - NPM Failed: npm ERR! code ENOLOCAL

My change was that I used CodeUri in Resources of type AWS::Serverless::Function.

QUICK FIX: just use Handler and remove CodeUri !..your Handler key should point to the location of exported function that you want to run, such as, src/folder-name/file-name.lambdaHandler

you can read a detailed explanation here

Top comments (0)