npm install –force in vercel deployment

I have hosted an next js application in vercel. At some point, the npm dependencies doesn’t worked properly with npm install

It got error as Vercel deployment build failed with command npm install exited with 1

I have used the command npm install --force in my local box. I was checking how to achieve the same in my vercel deployment as well.

After sometime found these settings in vercel where we can can override the default Install command and provide our custom command.

I have override the settings and gave my custom command npm install --force in the Build & Development Settings.

The setting present under Project → Settings → General → Build & Development Settings.

Happy Coding!

ReactDOM.render is no longer supported in React 18

If you are using ReactDOM.render() in your React 18 app, you will definitely see the below issue.

ReactDOM.render is no longer supported in React 18

The reason is ReactDOM.render is no longer supported in React 18.

Earlier, we used to render the component in below way

ReactDOM.render(<NavBar />, document.getElementById('root'))

If we are using React 18, we should start using createRoot() instead of render()

Example

ReactDOM.createRoot(document.getElementById('root')).render(<NavBar />)

The render() method of the react-dom package is considered legacy starting react-dom version 18.

The method is replaced with the createRoot() method that is exported from react-dom/client.

The createRoot() method takes the root element as a parameter and creates a React root.

Happy Coding!