我正在尝试 运行 npm start 在我的终端中,但它不起作用
I am trying to run npm start in my terminal, but it isn't working
我正在尝试 运行 npm start
开始一个新的 React 项目,但它不起作用。我已经这样做了很多次,但现在出现以下错误:
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 (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/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 (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:417:16)
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:452:10
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:323:13
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/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'
}
Node.js v17.2.0
EgorUlybin@MacBook-Pro routing %
在浏览器中,我收到的错误消息是:
The site can't be reached
localhost refused to connect.
可能是NodeJS版本问题
通过 nvm 将您的 NodeJS 版本从 当前 (17) 版本降级到 LTS (16) 版本。
我找到了解决此问题的技巧。
只需使用 yarn create-react-app my-app
创建一个新的 React 应用程序,然后复制 node_modules
文件夹并用它替换之前的 React 应用程序 node_modules
文件。
我正在尝试 运行 npm start
开始一个新的 React 项目,但它不起作用。我已经这样做了很多次,但现在出现以下错误:
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 (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/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 (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:417:16)
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:452:10
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/webpack/lib/NormalModule.js:323:13
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /Users/EgorUlybin/Desktop/Programming/practice folder/React/routing/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'
}
Node.js v17.2.0
EgorUlybin@MacBook-Pro routing %
在浏览器中,我收到的错误消息是:
The site can't be reached
localhost refused to connect.
可能是NodeJS版本问题
通过 nvm 将您的 NodeJS 版本从 当前 (17) 版本降级到 LTS (16) 版本。
我找到了解决此问题的技巧。
只需使用 yarn create-react-app my-app
创建一个新的 React 应用程序,然后复制 node_modules
文件夹并用它替换之前的 React 应用程序 node_modules
文件。