[英]npm install, -force flag
I was installing the packages on a NodeJS backend.我在 NodeJS 后端安装包。 Then I run into an error which was the following:
然后我遇到了以下错误:
gyp.js" rebuild gyp ERR: configure error gyp ERR, stack Error. Can't find Python executable "python", you can set the PYT HON env variable.
gyp.js" rebuild gyp ERR: configure error gyp ERR, stack Error. Can't find Python executable "python", 你可以设置 PYT HON 环境变量。
It said I need some python executable.它说我需要一些 python 可执行文件。 However when I run:
但是当我运行时:
npm i -force
Everything installs seems to be working fine.安装的一切似乎都运行良好。
npm i -force
different from a normal npm i
? npm i -force
与普通的npm i
有何不同?Like Liam has mentioned -force "forces" npm to re-download all packages and install them again.就像 Liam 提到的 -force "forces" npm 重新下载所有包并再次安装它们。 The issue that may arise from that is that obviously if you have too many packages it takes more time to download them each time.
可能由此产生的问题是,如果你有太多的包,那么每次下载它们都会花费更多的时间。
For the specific issue regarding gyp.js as far as I know node-gyp downloads some stuff in the $HOME directory and I assume the path in your case has some spaces.据我所知,对于关于 gyp.js 的具体问题,node-gyp 在 $HOME 目录中下载了一些东西,我假设你的路径中有一些空格。 Some tools do not handle spaces in paths which is why it cannot find the executable.
一些工具不处理路径中的空格,这就是它找不到可执行文件的原因。
Other possible solutions:其他可能的解决方案:
delete the $HOME/.node_gyp folder and run npm update
删除 $HOME/.node_gyp 文件夹并运行
npm update
install the libkrb5-dev package sudo apt-get install libkrb5-dev
安装 libkrb5-dev 包
sudo apt-get install libkrb5-dev
install the build-essential package sudo apt-get install build-essential
安装 build-essential 包
sudo apt-get install build-essential
I have found that if you are using a git #branch in a dependency that我发现如果你在依赖项中使用 git #branch
npm i -f
does not work.不起作用。 I have to change back to the default main and back again.
我必须改回默认的 main,然后再改回来。
"dependencies": {
"@custom-dependancy/one-framework": "git+ssh://git@github.com/Custom-Dependancy/one-framework.git#mybranch"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.