node: v16.7.0
cdk: 2.0.0 (build 4b6ce31)

package.json:

  "devDependencies": {
    "@types/jest": "^26.0.10",
    "@types/node": "10.17.27",
    "aws-cdk": "2.0.0",
    "jest": "^26.4.2",
    "ts-jest": "^26.2.0",
    "ts-node": "^9.0.0",
    "typescript": "^3.9.7"
  },
  "dependencies": {
    "aws-cdk-lib": "2.0.0",
    "constructs": "^10.0.0",
    "source-map-support": "^0.5.16"
  }

npm run build/watch stack trace:

node_modules/@types/prettier/index.d.ts:41:54 - error TS2315: Type 'IsTuple' is not generic.

41 type IndexProperties<T extends { length: number }> = IsTuple<T> extends true
                                                        ~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:53:6 - error TS2456: Type alias 'IsTuple' circularly references itself.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
        ~~~~~~~

node_modules/@types/prettier/index.d.ts:53:65 - error TS2574: A rest element type must be an array type.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
                                                                   ~~~~~~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:53:84 - error TS2315: Type 'IsTuple' is not generic.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
                                                                                      ~~~~~~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:96:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

96     call<
       ~~~~

node_modules/@types/prettier/index.d.ts:131:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

131     each<
        ~~~~

node_modules/@types/prettier/index.d.ts:165:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

165     map<
        ~~~

[2:30:13 PM] Found 7 errors. Watching for file changes.

我注意到package-lock.json中的jest-snapshot个更漂亮:

    "node_modules/jest-snapshot": {
      "version": "26.6.2",
      "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-26.6.2.tgz",
      "integrity": "sha512-OLhxz05EzUtsAmOMzuupt1lHYXCNib0ECyuZ/PZOx9TrZcC8vL0x+DUG3TL+GLX3yHG45e6YGjIm0XwDc3q3og==",
      "dev": true,
      "dependencies": {
        "@babel/types": "^7.0.0",
        "@jest/types": "^26.6.2",
        "@types/babel__traverse": "^7.0.4",
        "@types/prettier": "^2.0.0",
        "chalk": "^4.0.0",
        "expect": "^26.6.2",
        "graceful-fs": "^4.2.4",
        "jest-diff": "^26.6.2",
        "jest-get-type": "^26.3.0",
        "jest-haste-map": "^26.6.2",
        "jest-matcher-utils": "^26.6.2",
        "jest-message-util": "^26.6.2",
        "jest-resolve": "^26.6.2",
        "natural-compare": "^1.4.0",
        "pretty-format": "^26.6.2",
        "semver": "^7.3.2"
      },
      "engines": {
        "node": ">= 10.14.2"
      }
    },

有什么 idea 吗?

推荐答案

我时不时地面对这个问题,看起来这就是问题所在

建议的解决方案是在Dev依赖项中添加一个固定版本的prettier,这对我很有用.试试看

{
  "devDependencies": {
    "@types/prettier": "2.6.0"
  }
}

如果您使用projen进行诈骗,则应在projen中进行更改.js文件

devDeps: [
    '@types/prettier@2.6.0'
]

Node.js相关问答推荐

在导入时未找到Pupeteer-PAGE-Proxy包

使用NodeJS输出检索Base64图像的网络报废

自动将Selify打开的Chrome窗口移动到Mac OS中的第三个显示器

使用Node.js中的";类型";:";模块";不导入文件

NPM:无法导入本码模块

FHIR 服务器:尽管 JSON 格式正确,但在 POST 请求中接收未定义请求正文

从mongodb集合中获取每分钟数据的每小时数据

几个 lambda 共有的函数

无法通过 NextJS 访问 HTTP 帖子中的正文

Google App Engine 突然不允许我部署我的 node.js 应用程序

为什么后端开发需要单独的服务器?

Mocha调用所有it回调模拟(测试中间件)

无服务器部署使用无服务器组合抛出`spawn serverless ENOENT`

nvm / node / npm: node 12 的 npm 比 node 14 的更新?

为什么在调用数据库调用时我的参数没有定义?

当我使用 uuid 代码意外崩溃,然后工作正常?

如何将使用 Gulp 的 node 部署到 heroku

从 Node.js 应用程序查询 Heroku 托管的 Postgres 数据库时出现自签名证书错误

从 CoffeeScript 中的数组中删除一个值

Node.js 17.0.1 Gatsby 错误-数字信封 routine ::不支持 ... ERR_OSSL_EVP_UNSUPPORTED