首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >node.js npm本地安装ENOENT错误

node.js npm本地安装ENOENT错误
EN

Stack Overflow用户
提问于 2021-06-15 17:49:35
回答 1查看 668关注 0票数 0

我在一个正在接管开发的节点/react应用程序上运行npm install时出错。

我不想在全球范围内安装任何软件包。我在运行大苏尔的M1 Macbook Pro上。我用Homebrew完成了节点和npm的新安装。我还试着删除package-lock.json文件,清理npm缓存,并向目录中添加一个.npmignore文件,就像其他帖子所建议的那样;这些都不起作用。

以下是我运行npm install时的输出

代码语言:javascript
复制
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,这会导致一个稍微不同的错误:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-16 18:05:35

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

  • 确保安装了postgresql (如果您的项目包括postgresql,就像我的一样)。在带有自制的mac上,只需运行brew install postgresql.

即可

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

在做了这些更改后,我能够让我的网站安装和启动正确。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67991220

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档