jufrensius's avatar

npm run dev error

I was upgrading my Laravel version to 9 from 7 and it is running well in Laragon. But when I tried to run npm run dev it return an error

λ npm run dev

> dev
> npm run development


> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

10% building 1/2 modules 1 active C:\laragon\www\CAP-project\node_modules\laravel-mix\src\builder\mock-entry.jsnode:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (C:\laragon\www\CAP-project\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\laragon\www\CAP-project\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\laragon\www\CAP-project\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\laragon\www\CAP-project\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\laragon\www\CAP-project\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\laragon\www\CAP-project\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\laragon\www\CAP-project\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (C:\laragon\www\CAP-project\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (C:\laragon\www\CAP-project\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at C:\laragon\www\CAP-project\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at C:\laragon\www\CAP-project\node_modules\graceful-fs\graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.14.0
0 likes
8 replies
Sinnbeck's avatar

This is a npm error not related to laravel upgrading? Did you change package.json also ?

jufrensius's avatar

@Sinnbeck I didn't change any dependencies in package.json, and I don't know if the npm error is related to Laravel upgrading or not

Sinnbeck's avatar

@jufrensius Laravel is php and the error is javascript. So if it worked before the upgrade you must have changed something in regards to javascript as well. Upgraded node perhaps?

Sinnbeck's avatar

@jufrensius That might be the problem then. Try upgrading to the newest version of mix as well then. Version 6

jufrensius's avatar
jufrensius
OP
Best Answer
Level 1

Hi @Sinnbeck I have downgraded the node from 18 to 16.9.0, and it is running well. Thank you for helping me

23657689's avatar

I founded the answer. If u don't want to downgrade nodejs version then you could try this instead.

The easy solution is...

go to package.json and add the NODE_OPTIONS=--openssl-legacy-provider in the development command like this:

"development": "cross-env NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",

then npm run dev, it should works.

1 like

Please or to participate in this conversation.