【问题标题】:node.js npm local install ENOENT chmod errornode.js npm local install ENOENT chmod 错误
【发布时间】:2021-08-31 14:20:30
【问题描述】:

我尝试在我正在接管开发的节点/反应应用程序上运行 npm install 时遇到错误。

我不想在全球范围内安装任何软件包。我在运行 Big Sur 的 M1 Macbook Pro 上。我用 Homebrew 重新安装了 node 和 npm。我还尝试删除 package-lock.json 文件,清理 npm 缓存,并将 .npmignore 文件添加到目录中,正如其他一些帖子所建议的那样;这些都不起作用。

这是我运行npm install时的输出

MacBook-Pro-2 frontend % npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [my project name]-dashboard@0.1.0
npm ERR! Found: webpack@5.39.0
npm ERR! node_modules/webpack
npm ERR!   webpack@"5.39.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@6.0.0
npm ERR! node_modules/optimize-css-assets-webpack-plugin
npm ERR!   optimize-css-assets-webpack-plugin@"6.0.0" 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 /Users/<name>/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/<name>/.npm/_logs/2021-06-15T17_41_19_910Z-debug.log

我尝试运行npm install --legacy-peer-deps,这会导致稍有不同的错误:

MacBook-Pro-2 frontend % npm install --legacy-peer-deps
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/pinpoint@1.0.2: Moved to 'npm install @sideway/pinpoint'
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated @hapi/formula@1.2.0: Moved to 'npm install @sideway/formula'
npm WARN deprecated topojson@3.0.2: Use topojson-client, topojson-server or topojson-simplify directly.
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@16.1.8: Switch to 'npm install joi'
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/<name>/Developer/<directory>/frontend/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/<name>/Developer/<directory>/frontend/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/<name>/.npm/_logs/2021-06-15T17_41_57_785Z-debug.log

【问题讨论】:

  • 你能发布 package.json 吗?

标签: node.js reactjs npm node-modules


【解决方案1】:

我解决了自己的问题。我认为这是一个常见的错误信息,有很多潜在的解决方案;以下是我尝试过的两件事,为我解决了这个问题:

  • 确保您已安装 postgresql(如果您的项目包括一个 postgresql 数据库,如我的)。在带有自制软件的 Mac 上,只需运行 brew install postgresql

  • 我还将我的 Node.js 版本降级为最新的长期支持版本(之前我使用的是开发版本)。在撰写本文时,LTS 版本是 14.7。

进行这些更改后,我能够正确安装和启动我的网站。

【讨论】:

    猜你喜欢
    • 2013-08-02
    • 2020-02-20
    • 1970-01-01
    • 2019-11-21
    • 2017-11-05
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 2015-09-11
    相关资源
    最近更新 更多