问题描述
我正在尝试使用typescript/nodejs创建一个Azure函数.我的函数需要写入BlobService,为此,我需要安装sdk.
I'm trying to create an azure function using typescript / nodejs. My function needs to write to BlobService, so for this I need to install the sdk.
我发现我必须在功能应用程序的控制台中运行"npm install"(此链接 https://docs.microsoft.com/zh-我们/azure/azure-functions/functions-reference-node ),但是,出现此错误
I found I have to run 'npm install' in the function app's console (this linkhttps://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node), however, I get this error
D:\home\site\wwwroot> WARN [email protected] 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中,我看到此错误
In the npm-debug.log I see this error
30798 error tar.unpack untar error D:\local\AppData\npm-cache\azure\2.0.0-preview\package.tgz
我尝试删除node_modules文件夹,将package.json修剪为仅包含单个程序包,但每次仍然出现相同的错误.
I have tried to delete node_modules folder, I have trimmed package.json to include only a single package, and still I get the same error each time.
关于我可能做错了什么的建议吗?
Any suggestions of what I might be doing wrong ?
推荐答案
我可以使用"npm install azure-storage"通过主目录下的Kudu在Kudu上安装模块azure-storage,然后将整个node_modules复制到了此处有"home \ site \ wwwroot"文件夹.在那之后,我的函数加载似乎需要更长的时间,但是没有更多关于找不到该模块的抱怨.我使用的是标准的App Service计划,而不是消费计划.
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.
这篇关于如何为Azure Node.js函数包含Azure SDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!