vue运行报错问题error Command failed with exit code 1.

解决方法:治标不治本,每次运行前,先输入

$env:NODE_OPTIONS="--openssl-legacy-provider"

再运行

npm run dev  
yarn run v1.22.19
warning package.json: "dependencies" has dependency "script-loader" with range "0.7.2" that collides with a dependency in "devDependencies" of the same name with version "^0.7.2"
$ vue-cli-service serve --open
 INFO  Starting development server...
 10% building 2/2 modules 0 activei 「wds」: Project is running at http://localhost:9527/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\public
i 「wds」: 404s will fallback to /index.html
 10% building 2/5 modules 3 active ...\node_modules\webpack\hot\dev-server.jsError: 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 (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\util\createHash.js:90:53)
    at NormalModule._initBuildHash (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:401:16)
    at handleParseError (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:449:10)
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:481:5
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:342:12
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array. (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
 10% building 2/6 modules 4 active ...\node_modules\webpack\hot\dev-server.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 (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\util\createHash.js:90:53)
    at NormalModule._initBuildHash (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:401:16)
    at handleParseError (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:449:10)
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:481:5
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModule.js:342:12
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array. (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at D:\softdownload\google下载\crmeb_java-master\crmeb_java-master\admin\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.15.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

你可能感兴趣的:(webpack,前端,javascript)