cli: Netlify Dev Server doesn't start on Node 17.x/18.x

Describe the bug

Similar to this: https://github.com/netlify/cli/issues/2882#issue-939909811

Netlify Dev tries to start a server, it injects the environment variables, parses the configuration files and starts the local server of the framework, however it never starts the Netlify CLI’s server.

Till now, the behaviour has been observed with Vite and Create React App (but more frameworks could be affected). This has been observed on MacOS 12. Other Operating Systems have not been checked.

This works with Node 14.17.5, possibly with any other Node version than Node 17.

To Reproduce:

  1. Use Node 17 (17.0.1 at the time of writing).
  2. Try running netlify dev in a project (possibly in a Vite or CRA project)
  3. See that the dev server never starts.

Configuration

  System:
    OS: macOS 12.0.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 891.31 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.0.1 - ~/.nvm/versions/node/v17.0.1/bin/node
    npm: 8.1.1 - ~/.nvm/versions/node/v17.0.1/bin/npm

Expected behaviour

The Netlify Dev server should start.

CLI Output

Vite:

◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Starting Netlify Dev with vite

> dev
> vite


  vite v2.4.1 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 217ms.

Additional context

Marked low-priority as there’s a workaround to use a different Node version.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 21 (4 by maintainers)

Most upvoted comments

also having this issue with node 18!

I just created a bare CRA project and it doesn’t seem to be working with Node 17 at all. Here’s the log:

npx netlify dev
◈ Netlify Dev ◈
◈ Starting Netlify Dev with Create React App

> my-app@0.1.0 start
> react-scripts start

ℹ 「wds」: Project is running at http://192.168.0.109/
ℹ 「wds」: webpack output is served from 
ℹ 「wds」: Content not from webpack is served from /Users/hrishikesh/Desktop/my-app/public
ℹ 「wds」: 404s will fallback to /
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/hrishikesh/Desktop/my-app/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/hrishikesh/Desktop/my-app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/hrishikesh/Desktop/my-app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/hrishikesh/Desktop/my-app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/hrishikesh/Desktop/my-app/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/hrishikesh/Desktop/my-app/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:417:16)
    at /Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:452:10
    at /Users/hrishikesh/Desktop/my-app/node_modules/webpack/lib/NormalModule.js:323:13
    at /Users/hrishikesh/Desktop/my-app/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/hrishikesh/Desktop/my-app/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/hrishikesh/Desktop/my-app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /Users/hrishikesh/Desktop/my-app/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.0.1
◈ Command failed with exit code 1: npm run start. Shutting down Netlify Dev server

Doesn’t seem to be related to CLI. The setup works with Node 16. I believe this is because Webpack doesn’t play well with Node 17 yet.

In Gatsby v4 and Node v18. Running netlify dev gets stuck in Waiting for framework port 8000. This can be configured using the 'targetPort' property in the netlify.toml

Can confirm that this issue also persists on Node 18 as well.

My app uses create-react-app, and like the others on Node@17 (and above including 18), the local webpack server starts, however, the Netlify Dev server (localhost:8888) does not. (Both the react-app content and the functions are not available at 8888)

seanc ⋊> ~/c/nav-credit-card-update git:(main) node -v                                                                                                                                                                                11:49:22
v18.0.0
seanc ⋊> ~/c/nav-credit-card-update git:(main) netlify dev                                                                                                                                                                            11:49:24
◈ Netlify Dev ◈
◈ Ignored build settings env var: REACT_APP_API_BASE_URL_V3 (defined in .env file)
◈ Injected .env file env var: REACT_APP_API_BASE_URL_V3
◈ Ignored build settings env var: V3_AUTH_URL (defined in .env file)
◈ Injected .env file env var: V3_AUTH_URL
◈ Ignored build settings env var: V3_CLIENT_ID (defined in .env file)
◈ Injected .env file env var: V3_CLIENT_ID
◈ Ignored build settings env var: V3_CLIENT_SECRET (defined in .env file)
◈ Injected .env file env var: V3_CLIENT_SECRET
◈ Ignored build settings env var: REACT_APP_QA_API_BASE_URL_V3 (defined in .env file)
◈ Injected .env file env var: REACT_APP_QA_API_BASE_URL_V3
◈ Ignored build settings env var: QA_V3_AUTH_URL (defined in .env file)
◈ Injected .env file env var: QA_V3_AUTH_URL
◈ Ignored build settings env var: QA_V3_CLIENT_ID (defined in .env file)
◈ Injected .env file env var: QA_V3_CLIENT_ID
◈ Ignored build settings env var: QA_V3_CLIENT_SECRET (defined in .env file)
◈ Injected .env file env var: QA_V3_CLIENT_SECRET
◈ Injected .env file env var: REACT_APP_API_BASE_URL
◈ Injected .env file env var: REACT_APP_V3_AUTH_URL
◈ Injected .env file env var: REACT_APP_DEVELOPMENT
◈ Injected .env file env var: SERVER_PORT
◈ Loaded function GetTokenV3 http://localhost:8888/.netlify/functions/GetTokenV3.
◈ Functions server is listening on 57852
◈ Starting Netlify Dev with Create React App
yarn run v1.22.18
$ react-scripts start
ℹ 「wds」: Project is running at http://0.0.0.0:3000/
ℹ 「wds」: webpack output is served from 
ℹ 「wds」: Content not from webpack is served from /Users/seanc/code/nav-credit-card-update/public
ℹ 「wds」: 404s will fallback to /
Starting the development server...

Compiled successfully!

You can now view nav-reservation-cc-update in the browser.

  http://localhost:3000

Note that the development build is not optimized.
To create a production build, use yarn build.

@erezrokah This might be related to https://github.com/vitejs/vite/issues/5365? As per the organisation member:

In the current state, we don’t support node 17 right now.

Its rekt for me too…lets get it going @sw-yx