Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install fails and node version is different in kudu/DebugConsole vs webhost/ssh #7485

Closed
DVGY opened this issue Jun 22, 2021 · 5 comments

Comments

@DVGY
Copy link

DVGY commented Jun 22, 2021

Is your question related to a specific version? If so, please specify:

Azure function runtime ~3

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

Node js

Question

  1. https://xxx.azurewebsites.net/webssh/host. In this ssh console, npm install fails here
root@7:/home/site/wwwroot# node -v
v12.22.1
W
root@7:/home/site/wwwroot# ls
assets     node_modules       package.json  reports
host.json  package-lock.json  proxies.json
root@7:/home/site/wwwroot# rm -rf node_modules
root@7:/home/site/wwwroot# ls
assets  host.json  package-lock.json  package.json  proxies.json  reports
root@7:/home/site/wwwroot# npm install
npm WARN -git@1.0.0 No description
npm WARN -git@1.0.0 No repository field.
npm WARN -git@1.0.0 No license field.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /home/site/wwwroot/node_modules/xhr
npm ERR! dest /home/site/wwwroot/node_modules/.xhr.DELETE
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/home/site/wwwroot/node_modules/xhr' -> '/home/site/wwwroot/node_modules/.xhr.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-06-22T09_33_32_962Z-debug.log

root@7:/home/site/wwwroot# npm install
npm WARN -git@1.0.0 No description
npm WARN -git@1.0.0 No repository field.
npm WARN -git@1.0.0 No license field.

npm ERR! code EPERM
npm ERR! syscall lchown
npm ERR! path /home/site/wwwroot/node_modules/.bin/semver
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, lchown '/home/site/wwwroot/node_modules/.bin/semver'
npm ERR!  [OperationalError: EPERM: operation not permitted, lchown '/home/site/wwwroot/node_modules/.bin/semver'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, lchown '/home/site/wwwroot/node_modules/.bin/semver'] {
npm ERR!     errno: -1,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'lchown',
npm ERR!     path: '/home/site/wwwroot/node_modules/.bin/semver'
npm ERR!   },
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'lchown',
npm ERR!   path: '/home/site/wwwroot/node_modules/.bin/semver',
npm ERR!   parent: 'wwwroot'

  1. In Kudu/debug Console node version is 14.15.0, so If I do npm install here, my function does not work. Because I need node v12 here.

Why in kudu console node version is different ?

Please help to resolve this.

@ghost ghost assigned brettsam Jun 22, 2021
@v-bbalaiagar v-bbalaiagar self-assigned this Jun 22, 2021
@v-bbalaiagar
Copy link

Hi @DVGY, Thank you for reaching out to us, checking internally on this issue.

@pragnagopa
Copy link
Member

pragnagopa commented Jun 22, 2021

@DVGY - Please fill out details requested in the issue template. To better assist we need following info:

  • Which version of node did you set for your app?
  • For Windows -- check AppSetting : website_node_default_version
  • For Linux -- check site config property linuxFxVersion

See here for instructions on how to set node version

@DVGY
Copy link
Author

DVGY commented Jun 22, 2021

@pragnagopa Thanks for very fast response.
Initially I set up node v 12 LTS for Function App.
I was kind of confused by seeing two different node version in the ssh(v12) vs debugConsole(v14).

I actually did npm install in kudu console` so it created node js package bindings using node v14. But the Function actually run in v12 Container. So it was failing to run (canvas npm package)

I read your docs link
az functionapp config set --linux-fx-version "node|14" --name "<MY_APP_NAME>" --resource-group "<MY_RESOURCE_GROUP_NAME>"

Will the above command update the general settings in the Function App or directly the kudu node version ?

Can you also direct me towards how to recover the deleted Function App code or least see the code so that I can copy. I read your docs, and it said it is stored somewhere for 30 day.
I also tried to recover it using this guide docs.
It threw an error message some thing like conflict.

For now I solved the issues by creating a new Function App with node 14 LTS.

@pragnagopa
Copy link
Member

Will the above command update the general settings in the Function App or directly the kudu node version ?

For Linux, linuxFxVersion is a site configuration property. Setting this on the Function App will ensure right version of the node is available in Kudu and for your Function App Code

Can you also direct me towards how to recover the deleted Function App code or least see the code so that I can copy. I read your docs, and it said it is stored somewhere for 30 day.

If you have access to storage account that was attached to your function app, you can download content directly from storage account. Please open a separate issue if you need further assistance.

@DVGY
Copy link
Author

DVGY commented Jun 22, 2021

@pragnagopa Thanks alot I will be opening a new issue for this.

@DVGY DVGY closed this as completed Jun 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants