[Fix] Missing package “metro/src/lib/attachWebsocketServer”

The error “Missing package “metro/src/lib/attachWebsocketServer”” is an error that is invoked whenever you are coding in react-native and trying to run npx expo. Given below is the snippet of the error as well as an image:

Missing package "metro/src/lib/attachWebsocketServer"

I would like to share with you the steps I took to fix the “Missing package “metro/src/lib/attachWebsocketServer”” in your project file.

Why Missing package “metro/src/lib/attachWebsocketServer” error is seen?

The error, “Missing package “metro/src/lib/attachWebsocketServer”” is seen because of the new react native 0.69 version. In the new 0.69 version update, react native has stopped supporting the expo functions and methods.

The detailed solution to fix the error “Missing package “metro/src/lib/attachWebsocketServer””, is given below:

How to fix the error, “Missing package “metro/src/lib/attachWebsocketServer”?

To fix the error, you have to add the following command  “npx expo init --template@44.0.0 my-app“. If the error is still not fixed, you will have to upgrade the expo version you are using in your react native using the command npm i expo –location=global.

The expo package is an umbrella package that provides client-side code (for example, JavaScript) for accessing system capabilities in Expo applications like as contacts, camera, and location.

Some Expo APIs are included in the package, while others are included in universal modules in the parent packages directory.

To fix the error, “Missing package “metro/src/lib/attachWebsocketServer””, follow the steps given below:

Method 1: Add the code

To fix the error, “Missing package “metro/src/lib/attachWebsocketServer””, you will have to run the below mentioned code:

 npx expo init --template@44.0.0 my-app

This should fix the error, “Missing package”metro/src/lib/attachWebsocketServer””.

Method 2: Upgrade your expo Version

To fix the error, “Missing package “metro/src/lib/attachWebsocketServer””, you will have to upgrade your expo version to the latest version.

You can upgrade your expo version by following the below mentioned code:

npm i expo --location=global

This should fix the error, “Missing package”metro/src/lib/attachWebsocketServer””.

Conclusion

To fix the error “Missing package “metro/src/lib/attachWebsocketServer””, you will have to add the following command  npx expo init --template@44.0.0 my-app. If the error is not fixed you will have to upgrade the expo version you are using in your react native.