Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

NodejsNpmEsbuildBuilder:NpmInstall - NPM Failed: npm WARN config production Use `--omit=dev` instead

Aperta
#553 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
nodejs, python
Ambito
build-system

Direzione di ricerca

Inizia da aws_lambda_builders/workflows/nodejs_npm/actions.py alla riga indicata, quindi riproduci il problema con sam build utilizzando un layer node_modules e npm �3e=9.6.7, oppure npm i --production. Il lavoro è completato quando la build riesce senza che l'avviso di configurazione di produzione di npm venga trattato come un errore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area/workflow/node_npm
Description:

It looks like at some point npm deprecated the --production parameter and started WARNing about it in stderr, which seems to break sam build.

I'm not sure which version of npm introduced that but the relevant range in npm code git-blames back to a couple years ago.

I found --production still in unconditional use in the corresponding builder {actions.py:111}. I think it needs to be upgraded to --omit=dev depending on the npm version.

Steps to reproduce:

sam build with a node_modules layer and npm version >= 9.6.7
Alternatively, just run npm i --production and observe the same warning. Clearly, it's not supposed to be called with --production anymore.

Observed result:
 Running NodejsNpmEsbuildBuilder:CopySource
 Running NodejsNpmEsbuildBuilder:CopySource
 Running NodejsNpmEsbuildBuilder:NpmInstall
 Running NodejsNpmEsbuildBuilder:NpmInstall
 Running NodejsNpmEsbuildBuilder:NpmInstall
 Running NodejsNpmEsbuildBuilder:EsbuildBundle
 Running NodejsNpmEsbuildBuilder:EsbuildBundle
 Running NodejsNpmEsbuildBuilder:EsbuildBundle
Build Failed
Error: NodejsNpmEsbuildBuilder:NpmInstall - NPM Failed: npm WARN config production Use `--omit=dev` instead.
Expected result:

Wouldn't expect to see the warning, and wouldn't expect it to be treated as an error.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
  1. OS: image: node:18
  2. If using SAM CLI, sam --version: 1.98.0
  3. AWS region: us-east-1

Add --debug flag to any SAM CLI commands you are running

So the CI/CD pipeline failed, and I went to create this bug report, and then I read about --debug and added it to sam commands in the pipeline... But it did not fail this time! I'm confused and I cannot reproduce this issue reliably. Still, just looking at the code of aws-lambda-builders and npm, the problem seems to be present.

Lingua principale
Python
Stelle
381
Fork
161
Merge medio
9g 8h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-lambda-builders

Tutte le issue di aws/aws-lambda-builders

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.