如何将azure sdk包含在azure nodejs函数中?

时间:2017-07-12 02:17:30

标签: node.js azure azure-functions

我尝试使用typescript / nodejs创建一个azure函数。我的函数需要写入BlobService,所以我需要安装sdk。

我发现我必须运行'npm install'在功能应用程序的控制台(此链接 https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node)但是,我收到此错误

D:\home\site\wwwroot> WARN hack2017@1.0.0 No repository field.
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "D:\\Program Files (x86)\\nodejs\\6.5.0\\node.exe" "D:\\Program Files (x86)\\npm\\3.10.3\\node_modules\\npm\\bin\\npm-cli.js" "install" "azure-asm-storage"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.3
npm ERR! path D:\home\site\wwwroot\node_modules\.staging\lodash-92db4caf
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall scandir

npm ERR! Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\.staging\lodash-92db4caf'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\.staging\lodash-92db4caf'
npm ERR!     at Error (native)
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'scandir',
npm ERR!   path: 'D:\\home\\site\\wwwroot\\node_modules\\.staging\\lodash-92db4caf' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log

在npm-debug.log中,我看到了这个错误

30798 error tar.unpack untar error D:\local\AppData\npm-cache\azure\2.0.0-preview\package.tgz

我曾尝试删除node_modules文件夹,我已将trim.json修剪为仅包含一个包,但每次都会出现相同的错误。

有关我可能做错的任何建议吗?

1 个答案:

答案 0 :(得分:1)

I was able to install the module azure-storage via Kudu under the home folder using "npm install azure-storage", then just copied the whole node_modules to the "home\site\wwwroot" folder there. My function seems to take a bit longer to load after that, but there is no more complaint about not finding that module. I am using a standard App Service plan, not Consumption plan.

相关问题