Tag Archives: NPM error

[Solved] npm Error: error:0308010C:digital envelope routines::unsupported

error:0308010C:digital envelope routines::unsupported
This error occurs because of the recent release of OpenSSL3.0 in node.js V17 version, and OpenSSL3.0 adds strict limits on allowed algorithms and key sizes, which may affect the ecosystem cause some impact.

Some applications that can run normally before node.js V17, but in V17 and above versions may throw the following exceptions:

  this[kHandle] = new _Hash(algorithm, xofLen);

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports.__webpack_modules__.57442.module.exports (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:135907:62)
    at NormalModule._initBuildHash (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109317:16)
    to handleParseError ( /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/ 4 /bundle4.js: 109371 : 10 )
    at /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109403:5
    at /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109258:12
    at /Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:61157:3
    at iterateNormalLoaders (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:60998:10)
    at Array.<anonymous> (/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:60989:4) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',

Node.js v18.7.0
✨  Done in 1.92s.

It is said that this can be temporarily fixed by running the following command line

export NODE_OPTIONS=--openssl-legacy-provider

But the current test does not work, so I reinstalled node-v16.12.0, and npm also installed the corresponding version

Refer to https://nodejs.org/en/download/releases/ for the correspondence between node and npm versions

[Solved] NPM Error: gyp: No Xcode or CLT version detected!


Recently, using npm to install modules in macOS Catalina, the following errors often occur:

> node-gyp rebuild

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yangjian/Documents/temp/test001/node_modules/fsevents
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
  • Screenshot below



1. Try to repair with the following command

$ xcode-select --install

The system prompts the following information:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

In fact, there is no so-called “Software Update” to update

2. Correct posture

When I was unable to do anything, I found the following solution:

$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install

Analysis of npm error ENOTFOUND npm ERR! network request to https://npm.***.com/*** failed and the role of the .npmrc file

1. npm reports an error:

  Looking at a project today, an error was reported when executing npm install to install dependencies:

84 error code ENOTFOUND
85 error errno ENOTFOUND
86 error network request to https://npm.***.com/@umijs%2fpreset-react failed, reason: getaddrinfo ENOTFOUND npm.***.com npm.***.com:443
87 error network This is a problem related to network connectivity.
87 error network In most cases you are behind a proxy or have bad network settings.
87 error network
87 error network If you are behind a proxy, please make sure that the
87 error network 'proxy' config is set properly.  See: 'npm help config'

ENOTFOUND   npm ERR! network request to https://npm.zhonganonline.com/@umijs%2fpreset-react failed

  It means that the registration address of this mirror cannot be found.

  Why is there such a situation? Aren’t all npm installation mirror addresses downloaded from npm? So look at the project structure and found the .npmrc file

2. The role of the .npmrc file

  There may be a .npmrc file in the root directory of some projects. When you click to open it, there is only one sentence: registry= http://registry.npm.xxxx.com

  Is the npm warehouse mirror address

  In npm i, if there is this file in the project root directory, node_modules will be automatically installed from this mirror address, and there is no need to manually set the mirror address.

  So the problem is that there is a problem with the mirror address in the .npmrc file, just delete this file.

3. npm configuration and .npmrc file

(1) npm cli provides the npm config command for npm related configuration, through npm config ls -l you can view all the configurations of npm, including the default configuration.

(2) npm config set to modify the configuration items, after using the command configuration, all the comments in the configuration file will be deleted

(3) Some common configurations:

  proxy, https-proxy: Specify npm to use a proxy

  registry specifies the source of the npm download and installation package. Default: https://registry.npmjs.org/

npm config set prefix $dir

(4) npmrc file: In addition to using the npm config command of cli to display and modify the npm configuration, you can also directly modify the configuration through the .npmrc file.

How to Solve NPM Error: listen EADDRINUSE

Error:Listening to EADDRINUSE on the server
. setupListenHandle [as _listen2] (net.js:1335:14)
at listenInCluster (net.js: 1381:12)
at GetAddrInfoReqWrapdoListen [as callback] (net.js:1509:7)
at GetAddrInfoReqWrap. onlookup [as oncomplete] (dn .js:61:10)
at :
at emitErrorNT (net.js:1362:8)
at process. _tickCallback (internal/process/next_tick.js:63:19)
npm ERR!
npm !’ cross-env NODE_ENV=development webpack-dev-server -open -inline -hot -port 8080 ‘
npm ERR!exit status 1
npm ERR!
npm error! Failed in development script.
npm ERR! This may not be a problem with npm. There may be additional log output above.
npm Error! The full log of this run can be found in the following file:
C:\Users\MX\AppData\Roaming\npm-cache\_logs\ 2018 – 07 – 24 – t09_07_38_445z debug. Logs
EADDRINUSE:The given address is already in use
Port is occupied

sudo lsof -i :8088 // View port usage
sudo kill -9 47862 // kill the displayed PID


[Weex]Error in creating project NPM: unable to load file D:\program files\nodejs\node_ global\ weex.ps1 Because scripts are not allowed to run on this system.

Use weex to create a new app and find NPM error:

npm : The file D:\Program Files\nodejs\node_global\weex.ps1 could not be loaded because running scripts is disabled on this system. For more information, see https:
/go.microsoft.com/fwlink/?LinkID=135170 in about_Execution_Policies.
Location Line:1 Character: 1
+ npm run dev
+ ~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Because it is forbidden to run scripts on this system, that is to say, you do not have permission

// Output: Restricted
// Restricted

Restricted means that the state is prohibited. Give permission:

Set-ExecutionPolicy -Scope CurrentUser

// At the prompt, enter.


// Output: RemoteSigned

Then recreate the project.

NPM- Cannot find module ‘xxxxx’

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

Cannot find module ‘XXXXX’ has encountered this problem,
I have tried:

npm install semver 
npm install -g socket.io

This is not going to work.
and then find another solution.
first see if your NPM is useful. Check method: open the terminal and enter

npm -v

If the error is reported, then it is necessary to re-install NPM. First, the original NPM is deleted. The method is:
, you can go to the global NPM package to have a look, the path is:


Go to the Semver folder in NOde_modules in NPM and you’ll see that it’s empty! Or no, we will know why semver module can not be found!
1. First delete the global NPM package: just mentioned /usr/local/lib/node_modules/ NPM, this NPM folder delete
2. Go to /usr/local/lib/node_modules and clone git from GitHub

git clone --recursive git://github.com/isaacs/npm.git

This brings the new NPM package back to global node_modules

npm -v

Check it in the terminal. If you can print it out, that’s fine.