[SOLVED] Cannot find module '.meteor/.../@types/react'?

I’m running Meteor 2.7.1. I’m getting this error:

Error: Cannot find module ‘/path/to/my/app/.meteor/local/build/programs/server/node_modules/@types/react’

I don’t recall seeing this before. I’ve been running Meteor 2.7.1 for a while without this error.

How can I correct this?

I tried the following:

  • created a new Meteor installation with meteor create appname
  • copied my mongodb to the new installation
  • reinstalled my meteor packages
  • reinstalled my npm packages

… but I’m still getting the same error.


Hi @vikr00001 are you using it with TypeScript or JavaScript? Which node version and which React version?

I’m using it with:

  • Javascript
  • Node v14.19.1
  • React… checking… this seems odd:

My package.json says "react": "^18.2.0".

If I run meteor npm install react@18.2.0 I see:

+ react@18.2.0
updated 1 package and audited 989 packages in 5.121s

But if I run meteor npm -v react I see:


:question: :thinking:

npm -v is the command to get the version of npm

Thanks for clearing that up!

Okay, solved!

Somehow this line got inserted into the top of a new .js file I was working on:

import React from "@types/react";

…and that was all there was to it. :slight_smile:

1 Like