error Cannot find module 'is-windows'

about 2 months ago this error started to show up whenever I install a new package or update one and now I’m having trouble building because of it.

this error shows up for me in expo 43, I am currently using expo 44

when i deleted the node_modules folder and yarn.lock the error is gone but if i update the some packge the error returns

Hi @ytalokaio

What dependencies are you using. Also, what does the following give you if you run it in the root directory of your app?

grep -rl is-windows .

the command grep -rl is-windows . return this:

./node_modules/jscodeshift/node_modules/micromatch/package.json
./node_modules/postcss-discard-overridden/yarn.lock
./node_modules/react-native-linear-gradient/yarn.lock
./node_modules/microevent.ts/yarn.lock
./node_modules/is-windows/package.json
./node_modules/is-windows/index.js
./node_modules/is-windows/README.md
./node_modules/move-concurrently/package.json
./node_modules/webpack/node_modules/micromatch/package.json
./node_modules/braces/package.json
./node_modules/worker-rpc/yarn.lock
./node_modules/nanomatch/package.json
./node_modules/nanomatch/lib/utils.js
./node_modules/fork-ts-checker-webpack-plugin/node_modules/micromatch/package.json
./node_modules/react-native-masked-text/yarn.lock
./node_modules/sane/node_modules/micromatch/package.json
./node_modules/extglob/package.json
./node_modules/istanbul-reports/package.json
./node_modules/watchpack-chokidar2/node_modules/micromatch/package.json
./node_modules/uri-js/yarn.lock
./node_modules/.yarn-integrity
./node_modules/copy-concurrently/package.json
./node_modules/copy-concurrently/copy.js
./node_modules/react-native/ReactCommon/hermes/inspector/tools/msggen/yarn.lock
./yarn.lock

my package.json:

{
  "name": "name",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/eslint-parser": "^7.16.3",
    "@expo/webpack-config": "~0.16.2",
    "eslint": "^8.3.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-airbnb-base": "^14.2.1",
    "eslint-plugin-import": "^2.24.2",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-native": "^3.11.0",
    "jest-expo": "^44.0.0",
    "mocha": "^6.0.2",
    "react-devtools": "^3",
    "react-native-scripts": "^2.0.1",
    "react-test-renderer": "17",
    "schedule": "^0.4.0",
    "webpack-bundle-analyzer": "^4.4.0"
  },
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "jest"
  },
  "dependencies": {
    "@expo/vector-icons": "^12.0.0",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "~1.15.0",
    "@react-native-community/datetimepicker": "4.0.0",
    "@react-navigation/bottom-tabs": "^6.0.7",
    "@react-navigation/drawer": "^6.1.8",
    "@react-navigation/native": "^6.0.4",
    "@react-navigation/native-stack": "^6.2.2",
    "@react-navigation/stack": "^6.0.9",
    "axios": "0.24.0",
    "date-fns": "^2.26.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "expo": "^44.0.0",
    "expo-app-loading": "~1.3.0",
    "expo-apple-authentication": "~4.1.0",
    "expo-application": "~4.0.1",
    "expo-blur": "~11.0.0",
    "expo-camera": "~12.1.0",
    "expo-constants": "~13.0.0",
    "expo-contacts": "~10.1.0",
    "expo-device": "~4.1.0",
    "expo-facebook": "~12.1.0",
    "expo-firebase-analytics": "~6.0.0",
    "expo-image-picker": "~12.0.1",
    "expo-intent-launcher": "~10.1.0",
    "expo-linear-gradient": "~11.0.0",
    "expo-linking": "~3.0.0",
    "expo-notifications": "~0.14.0",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "expo-tracking-transparency": "~2.1.0",
    "expo-updates": "~0.11.3",
    "hermes-engine": "^0.10.0",
    "imutable": "^0.0.1",
    "jest": "^26.6.3",
    "loadtest": "^3.0.3",
    "moment": "^2.29.1",
    "moment-range": "^3.1.1",
    "prop-types": "^15.6.0",
    "query-string": "^6.2.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-calendar-strip": "^2.1.7",
    "react-native-calendars": "^1.1270.0",
    "react-native-elements": "^3.2.0",
    "react-native-fast-image": "^8.5.11",
    "react-native-gesture-handler": "~2.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.3.0",
    "react-native-masked-text": "^1.13.0",
    "react-native-modal": "13.0.0",
    "react-native-modal-datetime-picker": "^13.0.0",
    "react-native-paper": "^4.10.0",
    "react-native-reanimated": "~2.3.1",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.10.1",
    "react-native-snap-carousel": "^3.4.0",
    "react-native-touchable-scale": "^2.1.2",
    "react-native-web": "0.17.1",
    "react-native-webview": "11.15.0",
    "react-navigation-redux-helpers": "^2.0.8",
    "react-redux": "^7.2.5",
    "redux": "^4.1.1",
    "redux-devtools-extension": "^2.13.5",
    "redux-persist": "^5.4.0",
    "redux-thunk": "^2.2.0",
    "sentry-expo": "^4.0.0",
    "styled-components": "^3.0.2"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
    ]
  }
}

What does yarn why is-windows give you?

sorry for the delay to answer:
when the error Cannot find module ‘is-windows’ appears return this:

warning ../../../package.json: No license field
[1/4] Why do we have the module "is-windows"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
error We couldn't find a match!
Done in 0.94s.

It should return something like this:

% yarn why is-windows
yarn why v1.22.17
[1/4] 🤔  Why do we have the module "is-windows"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "is-windows@1.0.2"
info Reasons this module exists
   - "micromatch#nanomatch" depends on it
   - Hoisted from "micromatch#nanomatch#is-windows"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "20KB"
info Disk size with transitive dependencies: "20KB"
info Number of shared dependencies: 0
✨  Done in 0.16s.

is-windows should be fine. It should not cause a problem. It should be in your node_modules and your yarn.lock, but not your package.json unless you specifically want to make use of it in your code.

so the way i found to fix this error was running this command: yarn add is-windows
when i did this i never got more this error

Weird. That should not be necessary, but if it fixed it for you, then :+1:

yes it’s weird but thanks for helping me

1 Like