nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.74k stars 7.63k forks source link

process.env.npm_package_description does not return correct value #9948

Closed mbledkowski closed 2 years ago

mbledkowski commented 2 years ago

Is there an existing issue for this?

Current behavior

When running Nest.js application process.env.npm_package_description returns

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

Minimum reproduction code

https://github.com/neuwiki/neuwiki

Steps to reproduce

  1. nest n project (select yarn)
  2. cd project
  3. add console.log line in src/main.ts
  4. yarn start:dev

Expected behavior

Return a value from description in package.json

Package

Other package

No response

NestJS version

9.0.0

Packages versions

{
  "name": "back",
  "version": "0.0.1",
  "description": "neu.wiki backend API",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prisma:generate": "prisma generate",
    "prisma:dev:deploy": "prisma db push",
    "db:dev:rm": "docker compose rm back-mongo back-mongo-1 back-mongo-express-1 -s -f -v",
    "db:dev:up": "docker compose up -d",
    "db:dev:restart": "yarn db:dev:rm && yarn db:dev:up && sleep 5 && yarn prisma:dev:deploy",
    "setup_db": "ts-node ./db/main.ts",
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^9.0.0",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/jwt": "^9.0.0",
    "@nestjs/passport": "^9.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "@nestjs/swagger": "^6.0.4",
    "@prisma/client": "^4.0.0",
    "argon2": "^0.28.7",
    "dotenv": "^16.0.1",
    "ipfs": "0.62.3",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0",
    "web3": "^1.7.4"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "28.1.4",
    "@types/node": "^16.0.0",
    "@types/passport-jwt": "^3.0.6",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "28.1.2",
    "prettier": "^2.3.2",
    "prisma": "^4.0.0",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "28.0.5",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.0.0",
    "typescript": "^4.3.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

Node.js version

18.6.0

In which operating systems have you tested?

Other

Question on StackOverflow: https://stackoverflow.com/questions/73026271/nest-js-process-env-npm-package-description-does-not-return-correct-value

micalevisk commented 2 years ago

this is not related with the framework itself.

micalevisk commented 2 years ago

actually, this might or might be not a bug on @nestjs/cli but your reproduction didn't reproduce anything and it's not minimal. As I couldn't reproduce this myself, I'll leave this closed until you share a really minimal repro repository.

Why Reproductions are Required.

mbledkowski commented 2 years ago

this is not related with the framework itself. it is. but your reproduction didn't reproduce anything for me it reproduces the error, I tried it multiple times, creating multiple new projects. I'll leave this closed until you share a really minimal repro repository using my repository is not required to reproduce this bug, I added it in because it was a required field

jmcdo29 commented 2 years ago

I just left an answer on your StackOverflow question. This isn't related to Nest but to how the package managers work, and each one is different. If you do populate the package.json#description field, they all point to the same value, just make sure to restart the process completely