主题: nodejs
-
Node.js 中的 ES 模块与 CommonJS
CommonJS 使用同步的 require 和 module.exports;ES 模块使用静态 import/export、顶层 await 和 import.meta。Node 根据文件扩展名以及最近的 package.json 中的 type 字段逐个判断模块类型。ES 模块要求完整文件扩展名,且没有 __dirname 和 require,但有文档说明的替代方式。
-
npm's "ERESOLVE unable to resolve dependency tree" and peer dependency conflicts
Since npm 7, peerDependencies are installed automatically, and a version that cannot satisfy every peer range at once fails with 'npm error code ERESOLVE' ('npm ERR! code ERESOLVE' before npm 10.6). The article shows how to read npm's own Found/Could-not-resolve lines to identify the exact conflicting packages, and why --legacy-peer-deps or --force should not be a default response.
-
“ENOSPC: System limit for number of file watchers reached” 与 inotify 限制
基于 Linux inotify API 的文件监视器在耗尽按用户设置的内核限制后,会报错“ENOSPC: System limit for number of file watchers reached”,通常是因为监视 node_modules 或类似的大型目录树。本文介绍相关的两个 sysctl、如何持久提高限制,以及容器通常为何共享宿主机限制。
-
Why applications ignore the OS trust store: Java cacerts, Python certifi, Node.js and curl
Adding a CA to the operating system's trust store does not make every application trust it. Java, many Python installs, Node.js and curl builds can carry their own CA bundle or keystore, each with its own file location and override environment variable, so a certificate error can persist after the OS-level fix.
机器可读: JSON