Reputation: 1033
I'm trying trying to use a node module inside my Azure Functions project. I've tried following these instructions several times but still can't use the module I'm trying to bring in.
After bringing in my package.json and running npm install
, I can see the node_modules folder (actual modules are located in node_modules/.staging). Upon restarting the function and trying to run it, I get Error: Cannot find module '_____'
.
I'm following the instructions correctly. Any suggestions on how to get the modules to work?
Upvotes: 1
Views: 3133
Reputation: 17790
You did everything correctly, after npm install
, please wait for some time. Modules being in ./staging
folder means the installation is still in progress.
You will see added packages prompt in console after the installation is finished.
Update--Avoid long time waiting for module install.
As @brettsam mentioned in comment, with azure-functions-pack tool(also a module), we can place all the modules in a single file, no need to install online and wait. You can search for your function name to find your function scripts if you want to edit after publication.
Upvotes: 1