create-react-app로 작성한 프로젝트에서 바로 npm start를 시도하였으나, 오류가 발생함.
> {projet name}@0.1.0 start
> react-scripts start
node:internal/modules/cjs/loader:488
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /~/{project name}/node_modules/postcss-safe-parser/node_modules/postcss/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
at packageExportsResolve (node:internal/modules/esm/resolve:683:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/~/{project name}/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
build
또한 비슷한 원인으로 수행되지 않는다.
node.js
의 버전이 17
이상이라면, 기본적으로 작성되는 package.json의 scripts부문에서--openssl-legacy-provider
를 추가하여 "react-scripts --openssl-legacy-provider start"로 한다.6.과 통합
Starting the development server...
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 (/~/{project name}/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/~/{project name}/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/~/{project name}/node_modules/webpack/lib/NormalModule.js:471:10)
at /~/{project name}/node_modules/webpack/lib/NormalModule.js:503:5
at /~/{project name}/node_modules/webpack/lib/NormalModule.js:358:12
at /~/{project name}/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/~/{project name}/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/~/{project name}/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/~/{project name}/node_modules/react-scripts/scripts/start.js:19
throw err;
^
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 (/~/{project name}/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/~/{project name}/node_modules/webpack/lib/NormalModule.js:417:16)
at /~/{project name}/node_modules/webpack/lib/NormalModule.js:452:10
at /~/{project name}/node_modules/webpack/lib/NormalModule.js:323:13
at /~/{project name}/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /~/{project name}/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/~/{project name}/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /~/{project name}/node_modules/babel-loader/lib/index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
4-1. 4.에서 발생하는 오류는 다음 링크에서는 node 17버전에서 발생하는 오류로서, 사용중인 모듈이나 어플리케이션의 키 사이즈나 알고리즘이 더 이상 OpenSSL 3.0의 default에 호용되지 않아서 생기는 오류라고 한다.
--openssl-legacy-provider
를 붙임) / build도 같이 수정