为什么 npm 安装包不起作用?

huangapple go评论156阅读模式
英文:

Why are npm install packages not working?

问题

我正在尝试在本地部署以下Git仓库:

https://github.com/maxie112/gatsby-ecommerce-theme

我正在按照Mac OS上的确切说明操作。

以下是错误日志;

  1. maxdenhoed@m1-macbook-pro gatsby-ecommerce-theme % sudo npm install
  2. npm WARN ERESOLVE overriding peer dependency
  3. npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
  4. npm WARN Found: react@18.2.0
  5. npm WARN node_modules/react
  6. npm WARN react@"^18.0.0" from the root project
  7. npm WARN 8 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
  8. npm WARN
  9. npm WARN Could not resolve dependency:
  10. npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
  11. npm WARN node_modules/react-server-dom-webpack
  12. npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
  13. npm WARN node_modules/gatsby
  14. npm WARN
  15. npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
  16. npm WARN node_modules/react
  17. npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
  18. npm WARN node_modules/react-server-dom-webpack
  19. npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
  20. npm WARN node_modules/gatsby
  21. npm WARN ERESOLVE overriding peer dependency
  22. npm WARN While resolving: react-side-effect@2.1.1
  23. ...

我的建议:
看起来在尝试安装sharp和msgpackr-extract包时出现了错误,这可能导致npm包安装出现问题。错误消息提到这些包的目录无法删除,因为它们不是空的。

这个错误的一个可能原因是,在先前的安装尝试中,这些目录没有被正确清理,仍然存在文件。另一个可能性是,一些进程或程序可能正在占用这些目录中的文件,阻止它们被删除。

希望这些信息对你有所帮助。

英文:

I am trying to deploy the following git repo locally:

https://github.com/maxie112/gatsby-ecommerce-theme

I am following the exact instructions on Mac OS.

  1. These are the error logs;
  2. maxdenhoed@m1-macbook-pro gatsby-ecommerce-theme % sudo npm install
  3. npm WARN ERESOLVE overriding peer dependency
  4. npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
  5. npm WARN Found: react@18.2.0
  6. npm WARN node_modules/react
  7. npm WARN react@"^18.0.0" from the root project
  8. npm WARN 8 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
  9. npm WARN
  10. npm WARN Could not resolve dependency:
  11. npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
  12. npm WARN node_modules/react-server-dom-webpack
  13. npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
  14. npm WARN node_modules/gatsby
  15. npm WARN
  16. npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
  17. npm WARN node_modules/react
  18. npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
  19. npm WARN node_modules/react-server-dom-webpack
  20. npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
  21. npm WARN node_modules/gatsby
  22. npm WARN ERESOLVE overriding peer dependency
  23. npm WARN While resolving: react-side-effect@2.1.1
  24. npm WARN Found: react@18.2.0
  25. npm WARN node_modules/react
  26. npm WARN react@"^18.0.0" from the root project
  27. npm WARN 8 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
  28. npm WARN
  29. npm WARN Could not resolve dependency:
  30. npm WARN peer react@"^16.3.0 || ^17.0.0" from react-side-effect@2.1.1
  31. npm WARN node_modules/react-side-effect
  32. npm WARN react-side-effect@"^2.1.0" from react-helmet@6.1.0
  33. npm WARN node_modules/react-helmet
  34. npm WARN
  35. npm WARN Conflicting peer dependency: react@17.0.2
  36. npm WARN node_modules/react
  37. npm WARN peer react@"^16.3.0 || ^17.0.0" from react-side-effect@2.1.1
  38. npm WARN node_modules/react-side-effect
  39. npm WARN react-side-effect@"^2.1.0" from react-helmet@6.1.0
  40. npm WARN node_modules/react-helmet
  41. npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
  42. npm WARN deprecated puppeteer@7.1.0: Version no longer supported. Upgrade to @latest
  43. npm WARN deprecated devcert@1.2.0: critical regex denial of service bug fixed in 1.2.1 patch
  44. npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
  45. npm WARN deprecated async-cache@1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
  46. npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
  47. npm WARN cleanup Failed to remove some directories [
  48. npm WARN cleanup [
  49. npm WARN cleanup '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/msgpackr-extract',
  50. npm WARN cleanup [Error: ENOTEMPTY: directory not empty, rmdir '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/msgpackr-extract'] {
  51. npm WARN cleanup errno: -66,
  52. npm WARN cleanup code: 'ENOTEMPTY',
  53. npm WARN cleanup syscall: 'rmdir',
  54. npm WARN cleanup path: '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/msgpackr-extract'
  55. npm WARN cleanup }
  56. npm WARN cleanup ],
  57. npm WARN cleanup [
  58. npm WARN cleanup '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp',
  59. npm WARN cleanup [Error: ENOTEMPTY: directory not empty, rmdir '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'] {
  60. npm WARN cleanup errno: -66,
  61. npm WARN cleanup code: 'ENOTEMPTY',
  62. npm WARN cleanup syscall: 'rmdir',
  63. npm WARN cleanup path: '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'
  64. npm WARN cleanup }
  65. npm WARN cleanup ],
  66. npm WARN cleanup [
  67. npm WARN cleanup '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp',
  68. npm WARN cleanup [Error: ENOTEMPTY: directory not empty, rmdir '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'] {
  69. npm WARN cleanup errno: -66,
  70. npm WARN cleanup code: 'ENOTEMPTY',
  71. npm WARN cleanup syscall: 'rmdir',
  72. npm WARN cleanup path: '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'
  73. npm WARN cleanup }
  74. npm WARN cleanup ]
  75. npm WARN cleanup ]
  76. npm ERR! code 1
  77. npm ERR! path /Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/puppeteer
  78. npm ERR! command failed
  79. npm ERR! command sh -c node install.js
  80. npm ERR! The chromium binary is not available for arm64.
  81. npm ERR! If you are on Ubuntu, you can install with:
  82. npm ERR!
  83. npm ERR! sudo apt install chromium
  84. npm ERR!
  85. npm ERR!
  86. npm ERR! sudo apt install chromium-browser
  87. npm ERR!
  88. npm ERR! /Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:115
  89. npm ERR! throw new Error();
  90. npm ERR! ^
  91. npm ERR!
  92. npm ERR! Error
  93. npm ERR! at /Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:115:27
  94. npm ERR! at FSReqCallback.oncomplete (node:fs:207:21)
  95. npm ERR!
  96. npm ERR! Node.js v18.13.0
  97. npm ERR! A complete log of this run can be found in:
  98. npm ERR! /Users/maxdenhoed/.npm/_logs/2023-01-07T08_56_09_427Z-debug-0.log

My two cents:
It looks like there was an error while trying to install the sharp and msgpackr-extract packages, which may be causing issues with your npm package installation. The error message mentions that the directories for these packages could not be removed because they were not empty.

One potential cause for this error could be that these directories were not properly cleaned up during a previous installation attempt, and there are still files present in them. Another possibility is that some processes or programs may be holding onto files in these directories, preventing them from being deleted.
Please help

答案1

得分: 2

正如你所说,一些进程阻止了清理。在这种情况下,很可能是Chromedriver或Chrome。

我会通过命令行手动关闭它们,然后重新安装。
由于你在Mac上,也许可以尝试这样做:

  1. killall chromedriver
  2. killall chromium
英文:

As you said, some processes prevent the cleanup. Most likely Chromedriver or Chrome in this case.

I would close them manually via the command line and redo the installation.
As you're on Mac, maybe something like:

  1. killall chromedriver
  2. killall chromium

might be enough.

huangapple
  • 本文由 发表于 2023年1月7日 16:58:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75039131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定