I am following the functions tutorial at: https://docs.digitalocean.com/tutorials/jamstack-series-part-2-add-serverless-functions-to-app/ together with the sample project: https://github.com/digitalocean/sample-functions-nodejs-qrcode .
I have run into the same problem with the tutorial as with the sample project, but I will explain the issue in terms of sample project so that it can be replicated.
When it comes to executing:
doctl serverless deploy ., I get this error:
Deploying '/home/user/Files/serverless2/sample-functions-nodejs-qrcode' to namespace 'fn-xxx' on host 'https://faas-lon1-xxx.doserverless.co' Started running npm install --production in /home/user/Files/serverless2/sample-functions-nodejs-qrcode/qr/qr Output of failed build in /home/user/Files/serverless2/sample-functions-nodejs-qrcode/packages/qr/qr /bin/bash: npm: command not found Failures: Error: While deploying action 'qr/qr': 'npm install' exited with code 127
I have the latest version of Node (v18.7.0) and NPM (8.15.0) installed.
I don’t quite understand why it outputs
/bin/bash: npm: command not found because I get a proper version when I execute
node -v and
I have noticed that the command executed by doctl skips the packages directory and instead goes directly to
sample-functions-nodejs-qrcode/qr/qr (instead of
Does anyone know how to fix this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.