projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 652 forks source link

npm ci should be used instead of `npm install` for faster and more reliable deployments #3421

Closed aviita closed 2 months ago

aviita commented 1 year ago

Repro steps.

  1. Navigate to existing node project (or create new one with npx express-generator myExpressAppTest --view ejs)
  2. npm install kuduscript -g
  3. kuduscript -y --node
  4. Check created script for npm install call

Expected

Scripts does not call npm install, but npm ci.

Actual

Script calls npm install

Project structures.

in order to reproduce your issue at our end we need a simple github repository that highlights structure of the project

Mention any other details that might be useful.

npm ci is the command that is meant to be used in deployments instead of npm install:

This command is similar to npm install, except it's meant to be used in automated environments such as test platforms, continuous integration, and deployment -- or any situation where you want to make sure you're doing a clean install of your dependencies.

aviita commented 1 year ago

Not sure if selected correct repository to file this bug and would think this has been considered, but decided to make an issue on it before starting to modify the script my self. The build times are still not very optimal for me after starting to use Kudu with zip deploy and building on destination servers and noticed this.

Also the npm ci takes exact package versions from package.lock.json so should produce more stable build results as it does not modify the lock file.

jvano commented 2 months ago

Hi

If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure: https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

This way we can better track and assist you on this case

Thanks,

Joaquin Vano Azure App Service