team-supercharge / nest-amqp

Nest AMQP 1.0 module - NPM package: https://www.npmjs.com/package/@team-supercharge/nest-amqp
https://supercharge.io
MIT License
26 stars 13 forks source link

main field in package.json raise error under pm2 enviromment #52

Closed imjuni closed 2 years ago

imjuni commented 2 years ago

Hi, I have a question in main field in package.json.

  1. main field in package.json

    // ...
    "main": "dist/index.js",
    // ...
  2. ls -al result on installed package

    drwxr-xr-x imjuni staff 256 B  Mon Feb 21 16:20:25 2022  constant/
    drwxr-xr-x imjuni staff 192 B  Mon Feb 21 16:20:24 2022  decorator/
    drwxr-xr-x imjuni staff 256 B  Mon Feb 21 16:20:25 2022  domain/
    drwxr-xr-x imjuni staff 192 B  Mon Feb 21 16:20:25 2022  enum/
    drwxr-xr-x imjuni staff 192 B  Mon Feb 21 16:20:25 2022  exception/
    drwxr-xr-x imjuni staff 192 B  Mon Feb 21 16:20:25 2022  explorer/
    .rw-r--r-- imjuni staff 224 B  Sat Oct 26 17:15:00 1985  index.d.ts
    .rw-r--r-- imjuni staff 957 B  Sat Oct 26 17:15:00 1985  index.js
    drwxr-xr-x imjuni staff 320 B  Mon Feb 21 16:20:25 2022  interface/
    .rw-r--r-- imjuni staff 1.0 KB Sat Oct 26 17:15:00 1985  LICENSE
    .rw-r--r-- imjuni staff 1.8 KB Tue Mar  8 12:59:45 2022  package.json
    .rw-r--r-- imjuni staff 1.9 KB Sat Oct 26 17:15:00 1985  queue.module.d.ts
    .rw-r--r-- imjuni staff  10 KB Sat Oct 26 17:15:00 1985  queue.module.js
    .rw-r--r-- imjuni staff  27 KB Sat Oct 26 17:15:00 1985  README.md
    drwxr-xr-x imjuni staff 224 B  Mon Feb 21 16:20:24 2022  service/
    .rw-r--r-- imjuni staff 110 KB Sat Oct 26 17:15:00 1985  tsconfig.prod.tsbuildinfo
    drwxr-xr-x imjuni staff 320 B  Mon Feb 21 16:20:25 2022  util/

installed package don't have a dist directory.

  1. pm2 execution environment error raised by main field
    (node:16111) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Users/imjuni//nestjs-scaffolding/artifact/node_modules/@team-supercharge/nest-amqp/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
    (Use `node --trace-deprecation ...` to show where the warning was created)

I change 'dist/index.js' to 'index.js' after execute without error.

  1. environment
    • node 16.14.0
    • typescript 4.6.2
    • pm2 5.2.0
    • @nestjs/common 8.2.6
    • @team-supercharge/nest-amqp 3.0.3

How can I fix this?

raschan commented 2 years ago

Fixed by #60