【问题标题】:node.js:TypeError: Cannot read properties of null (reading 'matches')node.js:TypeError: 无法读取 null 的属性(读取 \'matches\')
【发布时间】:2022-08-16 16:18:27
【问题描述】:

我跑npm install canvas png-js date-fns axios crypto-js ts-md5 tslib @types/node dotenv typescript fs require tslib prettytable jsdom tough-cookie ws@7.4.3 jieba fs form-data json5 global-agent 它变成了

TypeError:无法读取 null 的属性(读取 \'matches\')

我阅读了日志文件:

TypeError:无法在 Link.matches 读取 null 的属性(读取 \'matches\')

我在node.js中读取了具体地址

 // if they\'re links, they match if the targets match
if (this.isLink) {
  return node.isLink && this.target.matches(node.target)
}

那么,我现在该怎么办? 非常感谢。


我试过了

rm -rf 节点模块

rm -rf package-lock.json

并得到

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   dev react@\"17.x\" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@\">=15.5 <=16.x\" from react-codemirror2@7.2.1
npm ERR! node_modules/react-codemirror2
npm ERR!   dev react-codemirror2@\"^7.2.1\" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-05-21T18_20_25_868Z-debug-0.log

我跑npm install react-codemirror2 --legacy-peer-deps 并得到

npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated @types/history@5.0.0: This is a stub types definition. history provides its own type definitions, so you do not need this installed.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added

added 1686 packages, and audited 1687 packages in 4m

100 packages are looking for funding
  run `npm fund` for details

13 vulnerabilities (3 moderate, 10 high)

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

那我该怎么办...

 # npm audit report

ansi-html  <0.0.8
Severity: high
Uncontrolled Resource Consumption in ansi-html - https://github.com/advisories/GHSA-whgm-jr23-g3j9
fix available via `npm audit fix --force`
Will install umi@3.5.3, which is a breaking change
node_modules/ansi-html
  @umijs/preset-built-in  <=3.5.24
  Depends on vulnerable versions of @umijs/bundler-webpack
  Depends on vulnerable versions of ansi-html
  Depends on vulnerable versions of mime
  node_modules/@umijs/preset-built-in
    umi  3.4.0-beta.1 - 3.5.24
    Depends on vulnerable versions of @umijs/bundler-webpack
    Depends on vulnerable versions of @umijs/preset-built-in
    node_modules/umi

async  <2.6.4
Severity: high
Prototype Pollution in async - https://github.com/advisories/GHSA-fwr7-v2mv-hh25
No fix available
node_modules/nedb/node_modules/async
  nedb  *
  Depends on vulnerable versions of async
  Depends on vulnerable versions of binary-search-tree
  node_modules/nedb

mime  <1.4.1
Severity: moderate
Regular Expression Denial of Service in mime - https://github.com/advisories/GHSA-wrvr-8mpx-r7pp
fix available via `npm audit fix --force`
Will install umi@3.5.3, which is a breaking change
node_modules/@umijs/preset-built-in/node_modules/mime


node-fetch  <=2.6.6
Severity: high
node-fetch is vulnerable to Exposure of Sensitive Information to an Unauthorized Actor - https://github.com/advisories/GHSA-r683-j2x4-v87g
The `size` option isn\'t honored after following a redirect in node-fetch - https://github.com/advisories/GHSA-w7rc-rwvf-8q5r
fix available via `npm audit fix --force`
Will install umi-request@1.2.3, which is a breaking change
node_modules/isomorphic-fetch/node_modules/node-fetch
  isomorphic-fetch  2.0.0 - 2.2.1
  Depends on vulnerable versions of node-fetch
  node_modules/isomorphic-fetch
    umi-request  >=1.2.4-beta.0
    Depends on vulnerable versions of isomorphic-fetch
    node_modules/umi-request

postcss  <=7.0.35
Severity: moderate
Regular Expression Denial of Service in postcss - https://github.com/advisories/GHSA-hwj9-h5mp-3pm3
Regular Expression Denial of Service in postcss - https://github.com/advisories/GHSA-566m-qj78-rww5
fix available via `npm audit fix --force`
Will install umi@3.5.3, which is a breaking change
node_modules/postcss
  @umijs/bundler-webpack  <=3.5.24
  Depends on vulnerable versions of postcss
  node_modules/@umijs/bundler-webpack

underscore  1.3.2 - 1.12.0
Severity: high
Arbitrary Code Execution in underscore - https://github.com/advisories/GHSA-cf4h-3jhx-xvhq
No fix available
node_modules/underscore
  binary-search-tree  *
  Depends on vulnerable versions of underscore
  node_modules/binary-search-tree

13 vulnerabilities (3 moderate, 10 high)

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.
  • 您能否尝试通过一一安装模块来缩小问题范围?

标签: node.js docker


【解决方案1】:

我对react-owl-carousel 有同样的问题。我试图进入package.json 文件并添加:

"overrides": "$react", "$react-dom"

这没有用。然后我尝试使用pnpm install,这似乎工作得很好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-28
    • 2022-01-12
    • 2021-12-04
    • 2022-01-06
    • 2021-11-14
    • 2021-12-17
    • 2022-01-09
    相关资源
    最近更新 更多