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

Running an error after the latest version is released #12417

Closed
3 of 15 tasks
xxwangkaimin opened this issue Sep 21, 2023 · 22 comments · May be fixed by nestjs/typescript-starter#280
Closed
3 of 15 tasks

Running an error after the latest version is released #12417

xxwangkaimin opened this issue Sep 21, 2023 · 22 comments · May be fixed by nestjs/typescript-starter#280
Labels
needs triage This issue has not been looked into

Comments

@xxwangkaimin
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

node_modules/@nestjs/common/file-stream/streamable-file.js:31
this.options.length ??= bufferOrReadStream.length;
^^^
SyntaxError: Unexpected token '??='

Minimum reproduction code

https://github.com/nestjs/typescript-starter

Steps to reproduce

No response

Expected behavior

normal operation

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

10.2.5

Packages versions

"dependencies": {
    "@nestjs-modules/ioredis": "^1.0.1",
    "@nestjs-modules/mailer": "^1.9.1",
    "@nestjs/common": "^10.2.5",
    "@nestjs/config": "^3.1.1",
    "@nestjs/core": "^10.2.5",
    "@nestjs/jwt": "^10.1.1",
    "@nestjs/mapped-types": "*",
    "@nestjs/passport": "^10.0.2",
    "@nestjs/platform-express": "^10.2.5",
    "@nestjs/swagger": "^7.1.11",
    "@nestjs/throttler": "^5.0.0",
    "@nestjs/typeorm": "^10.0.0",
    "axios": "^1.5.0",
    "bcryptjs": "^2.4.3",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "crypto-js": "^4.1.1",
    "dayjs": "^1.11.10",
    "helmet": "^7.0.0",
    "iconv-lite": "^0.6.3",
    "ioredis": "^5.3.2",
    "jssha": "^3.3.1",
    "md5": "^2.3.0",
    "mysql2": "^3.6.1",
    "nanoid": "^5.0.1",
    "node-xlsx": "^0.23.0",
    "nodemailer": "^6.9.5",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.1",
    "passport-local": "^1.0.0",
    "qiniu": "^7.9.0",
    "qs": "^6.11.2",
    "reflect-metadata": "^0.1.13",
    "request-ip": "^3.3.0",
    "rxjs": "^7.8.1",
    "svg-captcha": "^1.4.0",
    "systeminformation": "^5.21.8",
    "typeorm": "^0.3.17",
    "ua-parser-js": "^1.0.36",
    "uuid": "^9.0.1"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.1.18",
    "@nestjs/schematics": "^10.0.2",
    "@nestjs/testing": "^10.2.5",
    "@types/crypto-js": "^4.1.2",
    "@types/express": "^4.17.17",
    "@types/jest": "29.5.5",
    "@types/multer": "^1.4.7",
    "@types/node": "20.6.3",
    "@types/passport-jwt": "^3.0.9",
    "@types/passport-local": "^1.0.35",
    "@types/request-ip": "^0.0.38",
    "@types/supertest": "^2.0.12",
    "@types/ua-parser-js": "^0.7.37",
    "@types/uuid": "^9.0.4",
    "@typescript-eslint/eslint-plugin": "^6.7.2",
    "@typescript-eslint/parser": "^6.7.2",
    "cross-env": "^7.0.3",
    "eslint": "^8.49.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.0",
    "jest": "29.7.0",
    "prettier": "^3.0.3",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.3",
    "ts-jest": "29.1.1",
    "ts-loader": "^9.4.4",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "4.2.0",
    "typescript": "^5.2.2"
  }

Node.js version

18.18.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@xxwangkaimin xxwangkaimin added the needs triage This issue has not been looked into label Sep 21, 2023
@kamilmysliwiec
Copy link
Member

What version of Node do you use? AFAIR ??= assignment operator was added in v15/v16 so you shouldn't see any errors on Node 18

@xxwangkaimin
Copy link
Author

您使用什么版本的节点?AFAIR ??= 赋值运算符已在 v15/v16 中添加,因此您不应在 Node 18 上看到任何错误
1695307148165
1695307316953

@xxwangkaimin
Copy link
Author

What version of Node do you use? AFAIR ??= assignment operator was added in v15/v16 so you shouldn't see any errors on Node 18

I use PM2 for project initiation
json module.exports = { apps: [ { name: 'nest-manage-stage', script: 'dist/main.js', args: '', watch: true, ignore_watch: ['node_modules', 'public', 'logs'], exec_mode: 'cluster_mode', instances: '1', autorestart: true, max_memory_restart: '500M', merge_logs: true, log_date_format: 'YYYY-MM-DD HH:mm:ss', min_uptime: '60s', max_restarts: 30, restart_delay: 60, env_staging: { NODE_ENV: 'staging', PORT: '4000', } ] }
start command:
"pm2:stage": "pm2 start ecosystem.config.js --env staging"

@micalevisk
Copy link
Member

@xxwangkaimin Make sure you are using nodejs v16 or greater. That's required in Nestjs v10

@xxwangkaimin
Copy link
Author

@xxwangkaimin Make sure you are using nodejs v16 or greater. That's required in Nestjs v10

The nodejs version in Linux services is 18.18.0

@jmcdo29
Copy link
Member

jmcdo29 commented Sep 21, 2023

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

why reproductions are required


Most of us are using nest's latest version without an issue on node 16+. Whatever is going on seems to be localized and we need a way to actually reproduce it

@micalevisk
Copy link
Member

micalevisk commented Sep 21, 2023

@xxwangkaimin please run this in your terminal:

node -v
node -p "let a; a ??= 123"

you should see 123

Everything went fine here in v18.15.0 on Linux

@xxwangkaimin
Copy link
Author

@xxwangkaimin please run this in your terminal:

node -v
node -p "let a; a ??= 123"

you should see 123

Everything went fine here in v18.15.0 on Linux

I can output 123 according to your method

@micalevisk
Copy link
Member

@xxwangkaimin in that case, share some full code that reproduces your issue along with the steps to reproduce it.

@xxwangkaimin
Copy link
Author

@xxwangkaimin in that case, share some full code that reproduces your issue along with the steps to reproduce it.

I used npm i - legacy peer deps when installing dependencies, but I'm not sure if it's related to this.I have no problem developing and running locally. Once packaged and released for production, it won't work

@jmcdo29
Copy link
Member

jmcdo29 commented Sep 21, 2023

Where do you deploy for production? Is it using the same node version as you use for development?

@xxwangkaimin
Copy link
Author

Where do you deploy for production? Is it using the same node version as you use for development?

I released production on an Alibaba Cloud Linux server, and the node versions of the production and development environments are consistent

@xxwangkaimin
Copy link
Author

请提供最小复制存储库(Git 存储库/ StackBlitz / CodeSandbox项目)。

为什么需要复制品

我们大多数人都使用 Nest 的最新版本,在 Node 16+ 上没有出现问题。无论发生什么似乎都是本地化的,我们需要一种方法来实际重现它

I created a basic project using the command line to publish a project in the production environment. The basic project created with the command 'next new project-name' does not have any other features and there are no issues with the development environment. If I directly publish it to the production environment, an error will be reported

@jmcdo29
Copy link
Member

jmcdo29 commented Sep 22, 2023

This is purely an issue with your production environment not using the versions expected. We cannot debug this without knowing all the details. Now then likely pm2 is using some other node version then expected. Why? No clue, we don't have access to that. But this is not an issue with the framework

@jmcdo29 jmcdo29 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
@xxwangkaimin
Copy link
Author

This is purely an issue with your production environment not using the versions expected. We cannot debug this without knowing all the details. Now then likely pm2 is using some other node version then expected. Why? No clue, we don't have access to that. But this is not an issue with the framework

However, upgrading the version of Nodejs in the production environment from v16 to v18 has no effect

@TracyLDavidson
Copy link

@xxwangkaimin Make sure you are using nodejs v16 or greater. That's required in Nestjs v10

This worked for me! Thank you!

@edsonsantosilva
Copy link

Updating for Node 18 also worked for me

@dingyl666
Copy link

解决了吗,我用阿里云的服务器也遇到这个问题了

@xxwangkaimin
Copy link
Author

@dingyl666 我是阿里云服务器升级pm2到最新版本解决的

@dingyl666
Copy link

dingyl666 commented Feb 20, 2024

@dingyl666我是阿里云服务器升级pm2到最新版本解决的

我的pm2就是最新版本 不过我已经解决了 执行了一下pm2 kill就莫名其妙的好了

@floruitShow2
Copy link

@dingyl666 我是阿里云服务器升级pm2到最新版本解决的

兄弟,你用的pm2哪个版本啊,我安装最新版依然有这个报错

@xxwangkaimin
Copy link
Author

@floruitShow2 我当时更新的时候pm2最新版本是 5.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants