如何修复:功能监视递归在当前平台上不可用,该平台用于运行Node.js

编程入门 行业动态 更新时间:2024-10-17 00:20:29

如何修复:功能监视<a href=https://www.elefans.com/category/jswz/34/1771140.html style=递归在当前平台上不可用,该平台用于运行Node.js"/>

如何修复:功能监视递归在当前平台上不可用,该平台用于运行Node.js

我正在尝试在Docker容器中运行Typescript express.js。运行docker之后,出现以下错误:

> 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)

我的Dockerfile:

FROM node:alpine

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

CMD ["npm","start"]

和package.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/********"
  },
  "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"
  }
}
回答如下:

Node v14对fs.watch() API进行了重大更改,特别是recursive选项(Linux从未支持过now raises the ERR_FEATURE_UNAVAILABLE_ON_PLATFORM error if used on Linux。

错误报告和修复已提交至ERR_FEATURE_UNAVAILABLE_ON_PLATFORMfilewatcher

在合并该修补程序并发布新版本之前,您需要坚持使用NodeJS https://github/fgnass/filewatcher/pull/6软件包以包括该补丁。

更多推荐

如何修复:功能监视递归在当前平台上不可用,该平台用于运行Node.js

本文发布于:2024-05-07 16:04:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1757047.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:递归   不可用   功能   平台上   平台

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!