简体   繁体   English

创建 NPM 项目和 NPM 安装时出错,错误 errno 4294967295

[英]Error on create an NPM project and NPM Install, error errno 4294967295

I can't run NPM Install on this computer, other laptop it works good.我无法在这台计算机上运行 NPM 安装,其他笔记本电脑运行良好。 What if tried reinstall Windows, Visual Code, WSL 2, NodeJS, NVM.. without success.如果尝试重新安装 Windows、Visual Code、WSL 2、NodeJS、NVM.. 没有成功怎么办。

I have tried just: npx create-react-app hello_world nothing works.我试过了: npx create-react-app hello_world没有任何效果。 Search on Google of course but also no solution that works.当然在谷歌上搜索,但也没有有效的解决方案。

I have removed folder node_modules and done npm cache clean --force我已删除文件夹node_modules并完成npm cache clean --force

NPM Version: 6.14.13 NPM 版本:6.14.13

Last part of error log:错误日志的最后一部分:

46182 verbose Windows_NT 10.0.19042
46183 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template"
46184 verbose node v14.17.0
46185 verbose npm  v6.14.13
46186 error code ELIFECYCLE
46187 error errno 4294967295
46188 error core-js@2.6.12 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
46188 error Exit status 4294967295
46189 error Failed at the core-js@2.6.12 postinstall script.
46189 error This is probably not a problem with npm. There is likely additional logging output above.
46190 verbose exit [ 4294967295, true ]

Hope some of you have another solution which I can try.希望你们中的一些人有我可以尝试的另一种解决方案。

The error log you provide indicates that there is a problem with the postinstall script on core-js@2.6.12 .您提供的错误日志表明postinstall上的安装后脚本core-js@2.6.12问题。 That is a legacy version of core-js but that's what create-react-app currently uses.那是core-js的旧版本,但这就是create-react-app当前使用的。

The postinstall script for that version of core-js prints a banner asking for funding for the project.版本的core-jspostinstall脚本会打印一条横幅,要求为该项目提供资金。 That is the only thing it does.这是它唯一的作用。

Line 34 of the code shows a bunch of environment variables that will bypass the banner printing if they are set.代码的第 34 行显示了一组环境变量,如果设置了这些环境变量,它们将绕过横幅打印。 These environment variables are:这些环境变量是:

  • ADBLOCK
  • CI
  • DISABLE_OPENCOLLECTIVE
  • SILENT
  • OPEN_SOURCE_CONTRIBUTOR

If you set one of those environment variables, the error will (probably) not occur.如果您设置其中一个环境变量,则(可能)不会发生错误。 (I say "probably" because I don't have a machine that is having the problem you are having, and so I can't test.) (我说“可能”是因为我没有遇到您遇到的问题的机器,所以我无法测试。)

It might be hard to solve your problem, cause of lack of information, but there are some steps, that you can follow.由于缺乏信息,可能很难解决您的问题,但是您可以遵循一些步骤。

First of all try this (you should replace path with your shell path):首先试试这个(你应该用你的 shell 路径替换路径):

npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"

NodeJs spawning separate process for core-js (you have proof in your logs node -e... ), to do that it needs shell to run it. NodeJscore-js生成单独的进程(您在日志node -e...中有证据),为此它需要 shell 来运行它。 Sometimes on Windows instead of taking shell path from environment variable it might be hardcoded, so if your shell isn't on hardcoded path, it will fail.有时在Windows上,而不是从环境变量中获取 shell 路径,它可能是硬编码的,所以如果你的 shell 不在硬编码路径上,它将失败。 That's might be a reason why your command failing with core-js .这可能是您的命令使用core-js失败的原因。

If it doesn't help, you can try those steps:如果没有帮助,您可以尝试以下步骤:

  1. Try to install different versions of node (you can use nvm or nvm-windows ),尝试安装不同版本的node (可以使用nvmnvm-windows ),
  2. Make sure your firewall is not blocking your application (you can try to turn it off for a moment),确保您的firewall没有阻止您的应用程序(您可以尝试将其关闭一会儿),
  3. Try to run your terminal/IDE as admin ( right click -> run as administrator ) - be careful with that (read comment below) ,尝试以管理员身份运行您的终端/IDE( right click -> run as administrator ) - 请注意(阅读下面的评论)
  4. Try to checkout other react or pure js application from github (eg react-bootstrap-starter or minimal-react-starter ),尝试从 github 签出其他reactpure js应用程序(例如react-bootstrap-starter或 minimum -react-starter ),
  5. Try to use powershell / cmd / git bash and just check if simple npm install with minimal js project will run. Try to use powershell / cmd / git bash and just check if simple npm install with minimal js project will run.
  6. If nothing of above doesn't work run your command with --loglevel verbose to get more information about error.如果以上都不起作用,请使用--loglevel verbose运行您的命令以获取有关错误的更多信息。

If nothing of above worked for you, please update your post with extended logs and try to provide more information what you have done after reinstalling windows, what model of laptop are you using and what exact windows (version and type eg Windows 10 N Professional, build 8019 ). If nothing of above worked for you, please update your post with extended logs and try to provide more information what you have done after reinstalling windows, what model of laptop are you using and what exact windows (version and type eg Windows 10 N Professional, build 8019 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM