Build Fails - Cannot find module

I have node version 14.17.2 (LTS). The tests works successfully locally.
But travis is saying ‘Cannot find Module’:

Installing SSH key from: default repository key
Using /home/travis/.netrc to clone repository.
git.checkout
0.72s$ git clone --depth=50 https://github.com/mattfrancis888/bobbyhill.git mattfrancis888/bobbyhill
0.01s
nvm.install
4.05s$ nvm install stable
cache.1
Setting up build cache
cache.npm
$ node --version
v16.4.1
$ npm --version
7.18.1
$ nvm --version
0.37.2
0.00s$ cd client
The command "cd client" exited with 0.
3.13s$ npm run test
> bobbyhill@0.1.0 test
> CI=false react-scripts test --env=jsdom
 FAIL  src/components/_rtl-tests/Header.test.tsx
  ● Test suite failed to run
    Cannot find module 'next-auth/client' from 'src/components/Header.tsx'
    Require stack:
      src/components/Header.tsx
      src/components/_rtl-tests/Header.test.tsx
      1 | import { getProviders, signOut } from "next-auth/client";
      2 | import { useRouter } from "next/router";
    > 3 | import { useSession } from "next-auth/client";
        | ^
      4 | import React, { useEffect, useState } from "react";
      5 | import { useTransition, animated, useSpring } from "@react-spring/web";
      6 | import { FcGoogle } from "react-icons/fc";
      at Resolver.resolveModule (../node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (src/components/Header.tsx:3:1)
 FAIL  src/components/_rtl-tests/Filter.test.tsx
  ● Test suite failed to run
    Cannot find module 'react-icons/ri' from 'src/components/Filter.tsx'
    Require stack:
      src/components/Filter.tsx
      src/components/_rtl-tests/Filter.test.tsx
      1 | import React, { useState, useEffect } from "react";
    > 2 | import { RiArrowDownSLine, RiArrowUpSLine } from "react-icons/ri";
        | ^
      3 | import FilterPopMenu from "./FilterPopMenu";
      4 | import FilterContent from "./FilterContent";
      5 | import useComponentVisible from "../helper/useComponentVisible";
      at Resolver.resolveModule (../node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (src/components/Filter.tsx:2:1)
Test Suites: 2 failed, 2 total
Tests:       0 total
Snapshots:   0 total
Time:        2.189 s
Ran all test suites.
The command "npm run test" exited with 1.
4.77s$ npm run test:coverage
> bobbyhill@0.1.0 test:coverage
> npm test -- --coverage
> bobbyhill@0.1.0 test
> CI=false react-scripts test --env=jsdom "--coverage"
 FAIL  src/components/_rtl-tests/Header.test.tsx
  ● Test suite failed to run
    Cannot find module 'next-auth/client' from 'src/components/Header.tsx'
    Require stack:
      src/components/Header.tsx
      src/components/_rtl-tests/Header.test.tsx
      1 | import { getProviders, signOut } from "next-auth/client";
      2 | import { useRouter } from "next/router";
    > 3 | import { useSession } from "next-auth/client";
        | ^
      4 | import React, { useEffect, useState } from "react";
      5 | import { useTransition, animated, useSpring } from "@react-spring/web";
      6 | import { FcGoogle } from "react-icons/fc";
      at Resolver.resolveModule (../node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (src/components/Header.tsx:3:1)
 FAIL  src/components/_rtl-tests/Filter.test.tsx
  ● Test suite failed to run
    Cannot find module 'react-icons/ri' from 'src/components/Filter.tsx'
    Require stack:
      src/components/Filter.tsx
      src/components/_rtl-tests/Filter.test.tsx
      1 | import React, { useState, useEffect } from "react";
    > 2 | import { RiArrowDownSLine, RiArrowUpSLine } from "react-icons/ri";
        | ^
      3 | import FilterPopMenu from "./FilterPopMenu";
      4 | import FilterContent from "./FilterContent";
      5 | import useComponentVisible from "../helper/useComponentVisible";
      at Resolver.resolveModule (../node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (src/components/Filter.tsx:2:1)
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |       0 |        0 |       0 |       0 |                   
 src               |       0 |        0 |       0 |       0 |                   
  Root.tsx         |       0 |        0 |       0 |       0 | 10-31             
  ...tWebVitals.ts |       0 |        0 |       0 |       0 | 3-10              
 src/components    |       0 |        0 |       0 |       0 |                   
  BurgerModal.tsx  |       0 |      100 |       0 |       0 | 19-36             
  Filter.tsx       |       0 |        0 |       0 |       0 | 6-89              
  ...erContent.tsx |       0 |        0 |       0 |       0 | 3-78              
  ...erPopMenu.tsx |       0 |      100 |       0 |       0 | 3-7               
  Header.tsx       |       0 |        0 |       0 |       0 | 19-255            
  Home.tsx         |       0 |      100 |       0 |       0 | 3-4               
  Modal.tsx        |       0 |      100 |       0 |       0 | 21-38             
  ...lePopMenu.tsx |       0 |      100 |       0 |       0 | 4-11              
 src/helper        |       0 |        0 |       0 |       0 |                   
  ...ntVisible.tsx |       0 |        0 |       0 |       0 | 4-23              
 src/pages         |       0 |        0 |       0 |       0 |                   
  _app.tsx         |       0 |      100 |       0 |       0 | 5                 
  _document.tsx    |       0 |      100 |       0 |       0 | 5-7               
  index.tsx        |       0 |        0 |       0 |       0 | 10-56             
  secret.tsx       |       0 |        0 |       0 |       0 | 5-18              
  signin.tsx       |       0 |        0 |       0 | ;1m      0 | 10-33             
 ...pages/api/auth |       0 |      100 |       0 |       0 |                   
  ...nextauth].tsx |       0 |      100 |       0 |       0 | 43-48             
 src/reducers      |       0 |        0 |       0 |       0 |                   
  index.tsx        |       0 |        0 |       0 |       0 |                   
-------------------|---------|----------|---------|---------|-------------------
Test Suites: 2 failed, 2 total
Tests:       0 total
Snapshots:   0 total
Time:        3.484 s
Ran all test suites.
The command "npm run test:coverage" exited with 1.
0.25s$ CI=false npm run build
> bobbyhill@0.1.0 build
> next build
sh: 1: next: not found
The command "CI=false npm run build" exited with 127.
cache.2
store build cache
Done. Your build exited with 1.

My travis.yml

language: node_js
node_js:
    - "stable"
cache:
    directories:
        - node_modules

script:
    - cd client
    - npm run test
    - npm run test:coverage
    - CI=false npm run build

notifications:
    email: false

Imprint