(41条消息) npm run dev 报错:Error: error:0308010C:digital envelope routines::unsupported_爱的叹息的博客-CSDN博客

 npm版本要和node版本对应(上文博主讲解很详细),所以要降低npm版本。但是我降低了以后还是报这个错。

error:0308010C:digital envelope routines::unsupported
出现这个错误是因为 node.js V17版本中最近发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成一些影响.

在node.js V17以前一些可以正常运行的的应用程序,但是在 V17 版本可能会抛出以下异常:

目前可以通过运行以下命令行临时解决这个问题
set NODE_OPTIONS=--openssl-legacy-provider

然后我的可以打开网页了。但是下一次npm start还是会出现这样的问题;

所以寻找其他解决方法:

如何处理 Node 报错 Error: error:0308010c:digital envelope routines::unsupported (freecodecamp.org)

  • 打开终端,运行 npm uninstall react-scripts
  • 运行 npm install react-scripts

然后出现了新错误如下:

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "babel-jest": "^26.6.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-jest was detected higher up in the tree:

  C:\Users\luojiu\node_modules\babel-jest (version: 27.5.1)

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if C:\Users\luojiu\node_modules\babel-jest is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls babel-jest in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed babel-jest.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.

然后按照提示可以运行了,但是出现了一大堆警告。。。。。但是好歹运行成功了……

 最后下载了nvm

然后想要降低node的版本,然后nvm有个bug,看下面第二篇。  

所以直接下载安装了node的16.18.1版本放进了nvm里面改名为v16.18.1,然后不报错了,可以顺利打开了。

 

 

(41条消息) Vue 报错error:0308010C:digital envelope routines::unsupported_IDrens的博客-CSDN博客 

(41条消息) [已解决]nvm安装node成功,安装npm失败npm不是内部或者外部的命令 + nvm安装步骤详解_五花漏的博客-CSDN博客_error while creating c:\users\administrator\appdat 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐