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

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

Why are npm install packages not working?

问题

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

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

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

以下是错误日志;

maxdenhoed@m1-macbook-pro gatsby-ecommerce-theme % sudo npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   react@"^18.0.0" from the root project
npm WARN   8 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react-server-dom-webpack
npm WARN   react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
npm WARN   node_modules/gatsby
npm WARN 
npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react
npm WARN   peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN   node_modules/react-server-dom-webpack
npm WARN     react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
npm WARN     node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-side-effect@2.1.1
...

我的建议:
看起来在尝试安装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.

These are the error logs;
maxdenhoed@m1-macbook-pro gatsby-ecommerce-theme % sudo npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   react@"^18.0.0" from the root project
npm WARN   8 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react-server-dom-webpack
npm WARN   react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
npm WARN   node_modules/gatsby
npm WARN 
npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react
npm WARN   peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN   node_modules/react-server-dom-webpack
npm WARN     react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@4.25.0
npm WARN     node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-side-effect@2.1.1
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   react@"^18.0.0" from the root project
npm WARN   8 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.3.0 || ^17.0.0" from react-side-effect@2.1.1
npm WARN node_modules/react-side-effect
npm WARN   react-side-effect@"^2.1.0" from react-helmet@6.1.0
npm WARN   node_modules/react-helmet
npm WARN 
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^16.3.0 || ^17.0.0" from react-side-effect@2.1.1
npm WARN   node_modules/react-side-effect
npm WARN     react-side-effect@"^2.1.0" from react-helmet@6.1.0
npm WARN     node_modules/react-helmet
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated puppeteer@7.1.0: Version no longer supported. Upgrade to @latest
npm WARN deprecated devcert@1.2.0: critical regex denial of service bug fixed in 1.2.1 patch
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
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.
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)
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/msgpackr-extract',
npm WARN cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/msgpackr-extract'] {
npm WARN cleanup       errno: -66,
npm WARN cleanup       code: 'ENOTEMPTY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/msgpackr-extract'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp',
npm WARN cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'] {
npm WARN cleanup       errno: -66,
npm WARN cleanup       code: 'ENOTEMPTY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp',
npm WARN cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'] {
npm WARN cleanup       errno: -66,
npm WARN cleanup       code: 'ENOTEMPTY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: '/Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/sharp'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path /Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! The chromium binary is not available for arm64.
npm ERR! If you are on Ubuntu, you can install with: 
npm ERR! 
npm ERR!  sudo apt install chromium
npm ERR! 
npm ERR! 
npm ERR!  sudo apt install chromium-browser
npm ERR! 
npm ERR! /Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:115
npm ERR!                     throw new Error();
npm ERR!                     ^
npm ERR! 
npm ERR! Error
npm ERR!     at /Users/maxdenhoed/Documents/1. Projects/GoReach/website2/gatsby-ecommerce-theme/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:115:27
npm ERR!     at FSReqCallback.oncomplete (node:fs:207:21)
npm ERR! 
npm ERR! Node.js v18.13.0

npm ERR! A complete log of this run can be found in:
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上,也许可以尝试这样做:

killall chromedriver
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:

killall chromedriver
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:

确定