0

I wanna run func command on VSCode, but the error is bellow.

<UserName>@W10-1911039 MINGW64 ~
$ func
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin/func ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\<UserName>\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin/func',
  path: 'C:\\Users\\<UserName>\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin/func',
  spawnargs: []
}

Environment

  • It is under the company proxy server.
    (proxy settings are set in ~/.bashrc file.)
  • python3 and node (and npm) are installed and the pass is through.
  • azure-functions-core-tools is installed on npm list -g

Additional Steps 1

I tried removing C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools and reinstalling, but the error is bellow.

<UserName>@W10-1911039 MINGW64 ~
$ npm list -g | grep azure

<UserName>@W10-1911039 MINGW64 ~
$ npm install -g azure-functions-core-tools
C:\Users\<UserName>\AppData\Roaming\npm\azurefunctions -> C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
C:\Users\<UserName>\AppData\Roaming\npm\func -> C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
C:\Users\<UserName>\AppData\Roaming\npm\azfun -> C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js

> azure-functions-core-tools@2.7.2184 postinstall C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools
> node lib/install.js

attempting to GET "https://functionscdn.azureedge.net/public/2.7.2184/Azure.Functions.Cli.win-x64.2.7.2184.zip"
using proxy server "http://<CompanyProxyHost>:<PortNumber>"
Error: self signed certificate in certificate chain
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! azure-functions-core-tools@2.7.2184 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the azure-functions-core-tools@2.7.2184 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<UserName>\AppData\Roaming\npm-cache\_logs\2020-02-13T04_55_46_986Z-debug.log

Additional Steps 2

I set bellow in settings.json on VSCode.

{
    "http.proxy": "http://<CompanyProxyHost>:<PortNumber>",
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "http.proxyStrictSSL": false
}

And I tried reinstalling azure-functions-core-tools, but the erorr is bellow.

<UserName>@W10-1911039 MINGW64 ~
$ npm install -g azure-functions-core-tools
C:\Users\<UserName>\AppData\Roaming\npm\azfun -> C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
C:\Users\<UserName>\AppData\Roaming\npm\azurefunctions -> C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
C:\Users\<UserName>\AppData\Roaming\npm\func -> C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js

> azure-functions-core-tools@2.7.2184 postinstall C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools
> node lib/install.js

attempting to GET "https://functionscdn.azureedge.net/public/2.7.2184/Azure.Functions.Cli.win-x64.2.7.2184.zip"
using proxy server "http://<CompanyProxyHost>:<PortNumber>/"
Error: self signed certificate in certificate chain
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! azure-functions-core-tools@2.7.2184 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the azure-functions-core-tools@2.7.2184 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<UserName>\AppData\Roaming\npm-cache\_logs\2020-02-13T09_54_42_193Z-debug.log

Additional Steps 3

I run npm config set proxy http://<CompanyProxyHost>:<PortNumber>/ and npm config set strict-ssl false in ~/.npmrc and tried reinstalling azure-functions-core-tools, but the error is bellow.

<UserName>@W10-1911039 MINGW64 ~
$ npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.13.4 node/v12.14.1 win32 x64"

; userconfig C:\Users\<UserName>\.npmrc
proxy = "http://<CompanyProxyHost>:<PortNumber>/"
strict-ssl = false

; builtin config undefined
prefix = "C:\\Users\\<UserName>\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\<UserName>
; HOME = C:\Users\<UserName>
; "npm config ls -l" to show all defaults.


<UserName>@W10-1911039 MINGW64 ~
$ npm install -g azure-functions-core-tools
npm ERR! code EEXIST
npm ERR! path C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
npm ERR! dest C:\Users\<UserName>\AppData\Roaming\npm\azfun
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\<UserName>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js' -> 'C:\Users\<UserName>\AppData\Roaming\npm\azfun'
npm ERR! File exists: C:\Users\<UserName>\AppData\Roaming\npm\azfun
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<UserName>\AppData\Roaming\npm-cache\_logs\2020-02-14T02_00_32_376Z-debug.log

So I tried reinstalling azure-functions-core-tools with --force option, but the error is back to "Additional Steps 1".

korocche
  • 1
  • 3
  • It looks like your first installation failed, try removing C: \ Users \ \ AppData \ Roaming \ npm \ node_modules \ azure-functions-core-tools and reinstalling. – Cindy Pau Feb 13 '20 at 03:08
  • Thanks for your comment. I tried doing the steps you taught, but the error is above . – korocche Feb 13 '20 at 06:47
  • The problem you encountered now should be [this](https://github.com/Microsoft/vscode/issues/3492), it is related to your company's network agent. A solution is given in the link. Use `"http.proxyStrictSSL": false` in your settings.json file. – Cindy Pau Feb 13 '20 at 07:13
  • Thanks for your comment. I tried doing the steps you taught, but the error is above . – korocche Feb 13 '20 at 10:06
  • Hi, have a look of this: https://stackoverflow.com/questions/7559648/is-there-a-way-to-make-npm-install-the-command-to-work-behind-proxy – Cindy Pau Feb 13 '20 at 10:17
  • Do you encounter this problem when installing any package using npm? – Cindy Pau Feb 13 '20 at 10:25
  • Thanks comment. npm config set `http-proxy` and `strict-ssl` has been completed, but the error is not resolved(Because I was at home, I'm sorry not to know the error details). When installing only `azure-functions-core-tools`, I encounter this problem. – korocche Feb 13 '20 at 14:40

0 Answers0