Search code examples
node.jsazureazure-functionscommand-line-interfaceazure-deployment

Unable to deploy Azure Functions via CLI


I am attempting to deploy my azure functions to a function app using this command. func azure functionapp publish cost-and-usage-functions-function-app --force This exact line worked properly yesterday but now every time I run it I get this error. I would also like to mention that running func azure functionapp publish worked about half the time yesterday, the other half of the time it would stall out and do nothing and I have no idea as to why but now it never works at all.

events.js:287
      throw er; // Unhandled 'error' event
      ^

Error: spawn /usr/local/lib/node_modules/azure-functions-core-tools/bin/func EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'EACCES',
  code: 'EACCES',
  syscall: 'spawn /usr/local/lib/node_modules/azure-functions-core-tools/bin/func',
  path: '/usr/local/lib/node_modules/azure-functions-core-tools/bin/func',
  spawnargs: [
    'azure',
    'functionapp',
    'publish',
    'cost-and-usage-functions-function-app',
    '--force'
  ]
}

All I want to do is deploy 5 functions to a function app via cli, I'm open to any fixes to this problem, alternative cli deployment methods, anything at this point. I've already tried deleting node modules and rerunning npm install and that didn't work. Any help would be greatly appreciated thanks in advance.


Solution

  • So uninstalling the npm azure cli then reinstalling it fixed the issue I described in this question. The command still isn't consistent and sometimes just times out for seemingly no reason but this specific issue is solved.