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

Error: npm.cmd ls -prod -json -depth=1 failed with code 1 when run serverless package with serverless-bundle plugin #11746

Open
4 tasks done
matheusteodoro01 opened this issue Feb 10, 2023 · 1 comment
Assignees
Labels

Comments

@matheusteodoro01
Copy link

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest v3 release?

  • Yes, I'm using the latest v3 release

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

Error: npm.cmd ls -prod -json -depth=1 failed with code 1 when run serverless package with serverless-bundle plugin

Service configuration (serverless.yml) content

service: car-service

plugins:
  - serverless-bundle
  - serverless-dotenv-plugin
  - serverless-offline

custom:
  CarTableName: 'cars'
  CarImagesBucketName: 'car-images-kittech'
  serverless-offline:
    httpPort: 3001
    lambdaPort: 3000
    noPrependStageInUrl: true
  bundle:
    excludeFiles:
      - '**/*.spec.ts'
      - 'jest.setup.ts'
    externals:
      - '@nestjs/common'
      - '@nestjs/core'
      - '@nestjs/platform-express'

provider:
  name: aws
  runtime: nodejs16.x
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:ListBucket
        - s3:PutObject
      Resource:
        - Fn::GetAtt: [CarImagesBucket, Arn]
    - Effect: Allow
      Action:
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
      Resource:
        - Fn::GetAtt: [CarsTable, Arn]
  environment:
    CAR_TABLE: ${self:custom.CarTableName}
    CAR_IMAGES_BUCKET: ${self:custom.CarImagesBucketName}

functions:
  api:
    handler: src/main/api/handler.handler
    events:
      - httpApi: '*'

resources:
  Resources:
    CarImagesBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: ${self:custom.CarImagesBucketName}
    CarsTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ${self:custom.CarTableName}
        AttributeDefinitions:
          - AttributeName: carId
            AttributeType: S
        KeySchema:
          - AttributeName: carId
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1

Command name and used flags

npx serverless package

Command output

PS C:\Users\Matheus Teodoro\Desktop\Pessoais\Curso Serverless com Clean Architecture> npx serverless package
DOTENV: Loading environment variables from .env:
         - CAR_TABLE
         - CAR_IMAGES_BUCKET
         - LOG_LEVEL

Packaging car-service for stage dev (us-east-1)
serverless-bundle: CommonJS, ES3, or ES5 are not supported
Bundling with Webpack...
Environment: win32, node 16.17.0, framework 3.27.0 (local), plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: npm.cmd ls -prod -json -depth=1 failed with code 1
    at ChildProcess.<anonymous> (C:\Users\Matheus Teodoro\Desktop\Pessoais\Curso Serverless com Clean Architecture\node_modules\serverless-webpack\lib\utils.js:91:16)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1093:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

Environment information

PS C:\Users\Matheus Teodoro\Desktop\Pessoais\Curso Serverless com Clean Architecture> npx serverless --version
Framework Core: 3.27.0 (local)
Plugin: 6.2.3
SDK: 4.3.2
@medikoo
Copy link
Contributor

medikoo commented Feb 10, 2023

@matheusteodoro01 It is a plugin issue, please report at serverless-bundle repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants