prosource

해결 방법:Node.js를 실행하는 데 사용 중인 현재 플랫폼에서 재귀적으로 기능 감시를 사용할 수 없습니다.

probook 2023. 6. 12. 21:34
반응형

해결 방법:Node.js를 실행하는 데 사용 중인 현재 플랫폼에서 재귀적으로 기능 감시를 사용할 수 없습니다.

도커 컨테이너에서 typescript express.js를 실행하려고 합니다.도커를 실행한 후 다음 오류가 발생합니다.

> ts-node-dev src/app.ts

Using ts-node version 8.10.1, typescript version 3.9.2
TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
    at Object.watch (fs.js:1441:11)
    at add (/app/node_modules/filewatcher/index.js:74:34)
    at /app/node_modules/filewatcher/index.js:93:5
    at FSReqCallback.oncomplete (fs.js:176:5)

내 도커 파일:

FROM node:alpine

WORKDIR /app
COPY package.json .
RUN npm install
COPY . .

CMD ["npm","start"]

그리고 패키지.json 파일:

{
  "name": "app-name",
  "version": "1.0.0",
  "description": "Init master",
  "main": "src/app.ts",
  "scripts": {
    "build": "./node_modules/.bin/tsc",
    "start": "ts-node-dev src/app.ts"
  },
  "repository": {
    "type": "git",
    "url": "https://*****@dev.azure.com/********"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "celebrate": "^12.1.1",
    "colors": "^1.4.0",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "event-dispatch": "^0.4.1",
    "eventemitter3": "^4.0.0",
    "express": "^4.17.1",
    "helmet": "^3.22.0",
    "jsonwebtoken": "^8.5.1",
    "moment": "^2.25.3",
    "mongoose": "^5.9.13",
    "morgan": "^1.10.0",
    "ms": "^2.1.2",
    "pbkdf2": "^3.0.17",
    "redis": "^3.0.2",
    "reflect-metadata": "^0.1.13",
    "status-code-enum": "^1.0.0",
    "swagger-jsdoc": "^4.0.0",
    "swagger-ui-express": "^4.1.4",
    "ts-node": "^8.10.1",
    "typedi": "^0.8.0",
    "uuid": "^8.0.0",
    "winston": "^3.2.1"
  },
  "devDependencies": {
    "@types/express": "^4.17.6",
    "@types/mongoose": "^5.7.16",
    "@types/node": "^13.13.5",
    "ts-node-dev": "^1.0.0-pre.44",
    "typescript": "^3.8.3"
  }
}

추신: 수정 사항을 포함하기로 결정했습니다: 도커 파일 변경:

FROM node:lts-alpine

패키지를 변경합니다.json:

"start": "ts-node-dev src/app.ts --poll"

노드 v14는 에 획기적인 변화를 도입했습니다.fs.watch()API, 특히 그것은.recursiveLinux에서 지원된 적이 없는 옵션이 Linux에서 사용되면 오류가 발생합니다.

버그 보고서 및 수정 사항이 다음에 제출되었습니다.filewatcher: https://github.com/fgnass/filewatcher/pull/6

해당 수정 사항이 병합되고 새 버전이 출시될 때까지 노드를 고수해야 합니다.JS < v14 또는 오버라이드filewatcher패키지를 로컬로 설치하여 해당 패치를 포함합니다.

이 오류는 다음으로 인해 발생한 것으로 보입니다.node.jsv14, 수정하려면 다음 명령을 사용합니다.

ts-node-dev --poll src/app.ts

또는 의 다른 버전을 사용할 수 있습니다.node.js버전 14보다는

언급URL : https://stackoverflow.com/questions/61806341/how-to-fix-the-feature-watch-recursively-is-unavailable-on-the-current-platform

반응형