Home
Support Forums

Fail to compile... Cannot Find module:

Hi everyone!!
I’m having a problem deploying my react application.
When I have the deploy by github netlify gives an error saying it can’t find a module, but that module exists and it’s working perfectly in development. I’m using jsconfig.json to ease imports.

Github repo link: https://github.com/NicolaiHygino/NicoMusic

Thanks for reading the post! :smiley:

Edit: I tried putting the path in lowercase and using the CI= but it still didn’t solve the problem

12:10:57 PM: Build ready to start
12:10:59 PM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
12:10:59 PM: build-image tag: v4.3.0
12:10:59 PM: buildbot version: bfa1ece451875e5fe124c5b0a59bb85e0abb8d50
12:10:59 PM: Fetching cached dependencies
12:10:59 PM: Failed to fetch cache, continuing with build
12:10:59 PM: Starting to prepare the repo for build
12:10:59 PM: No cached dependencies found. Cloning fresh repo
12:10:59 PM: git clone https://github.com/NicolaiHygino/NicoMusic
12:11:00 PM: Preparing Git Reference refs/heads/main
12:11:00 PM: Parsing package.json dependencies
12:11:01 PM: Starting build script
12:11:01 PM: Installing dependencies
12:11:01 PM: Python version set to 2.7
12:11:02 PM: Downloading and installing node v16.9.0...
12:11:02 PM: Downloading https://nodejs.org/dist/v16.9.0/node-v16.9.0-linux-x64.tar.xz...
12:11:02 PM: Computing checksum with sha256sum
12:11:02 PM: Checksums matched!
12:11:06 PM: Now using node v16.9.0 (npm v7.21.1)
12:11:06 PM: Started restoring cached build plugins
12:11:06 PM: Finished restoring cached build plugins
12:11:06 PM: Attempting ruby version 2.7.2, read from environment
12:11:07 PM: Using ruby version 2.7.2
12:11:08 PM: Using PHP version 8.0
12:11:08 PM: Started restoring cached node modules
12:11:08 PM: Finished restoring cached node modules
12:11:08 PM: Installing NPM modules using NPM version 7.21.1
12:11:23 PM: npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
12:11:23 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
12:11:24 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
12:11:25 PM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
12:11:25 PM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
12:11:27 PM: npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
12:11:28 PM: npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
12:11:29 PM: npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
12:11:37 PM: npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
12:11:38 PM: npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
12:11:38 PM: npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
12:11:39 PM: npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
12:11:40 PM: npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
12:11:41 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
12:11:41 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
12:11:42 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
12:11:43 PM: npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
12:11:49 PM: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
12:11:50 PM: added 2024 packages, and audited 2025 packages in 41s
12:11:50 PM: 149 packages are looking for funding
12:11:50 PM:   run `npm fund` for details
12:11:50 PM: 10 moderate severity vulnerabilities
12:11:50 PM: To address issues that do not require attention, run:
12:11:50 PM:   npm audit fix
12:11:50 PM: To address all issues (including breaking changes), run:
12:11:50 PM:   npm audit fix --force
12:11:50 PM: Run `npm audit` for details.
12:11:50 PM: NPM modules installed
12:11:50 PM: Started restoring cached go cache
12:11:50 PM: Finished restoring cached go cache
12:11:50 PM: go version go1.16.5 linux/amd64
12:11:50 PM: go version go1.16.5 linux/amd64
12:11:50 PM: Installing missing commands
12:11:50 PM: Verify run directory
12:11:52 PM: ​
12:11:52 PM: ────────────────────────────────────────────────────────────────
12:11:52 PM:   Netlify Build                                                 
12:11:52 PM: ────────────────────────────────────────────────────────────────
12:11:52 PM: ​
12:11:52 PM: ❯ Version
12:11:52 PM:   @netlify/build 18.8.0
12:11:52 PM: ​
12:11:52 PM: ❯ Flags
12:11:52 PM:   baseRelDir: true
12:11:52 PM:   buildId: 613a2400328426000750890f
12:11:52 PM:   deployId: 613a24003284260007508911
12:11:52 PM: ​
12:11:52 PM: ❯ Current directory
12:11:52 PM:   /opt/build/repo
12:11:52 PM: ​
12:11:52 PM: ❯ Config file
12:11:52 PM:   No config file was defined: using default values.
12:11:52 PM: ​
12:11:52 PM: ❯ Context
12:11:52 PM:   production
12:11:52 PM: ​
12:11:52 PM: ────────────────────────────────────────────────────────────────
12:11:52 PM:   1. Build command from Netlify app                             
12:11:52 PM: ────────────────────────────────────────────────────────────────
12:11:52 PM: ​
12:11:52 PM: $ CI= npm run build
12:11:52 PM: > client@0.1.0 build
12:11:52 PM: > react-scripts build
12:11:54 PM: Creating an optimized production build...
12:11:59 PM: Failed to compile.
12:11:59 PM: 
12:11:59 PM: ./src/views/Login/index.js
12:11:59 PM: Cannot find module: 'services/spotifyapi/authentication'. Make sure this package is installed.
12:11:59 PM: You can install this package by running: npm install services/spotifyapi/authentication.
12:11:59 PM: ​
12:11:59 PM: ────────────────────────────────────────────────────────────────
12:11:59 PM:   "build.command" failed                                        
12:11:59 PM: ────────────────────────────────────────────────────────────────
12:11:59 PM: ​
12:11:59 PM:   Error message
12:11:59 PM:   Command failed with exit code 1: CI= npm run build
12:11:59 PM: ​
12:11:59 PM:   Error location
12:11:59 PM:   In Build command from Netlify app:
12:11:59 PM:   CI= npm run build
12:11:59 PM: ​
12:11:59 PM:   Resolved config
12:11:59 PM:   build:
12:11:59 PM:     command: CI= npm run build
12:11:59 PM:     commandOrigin: ui
12:11:59 PM:     publish: /opt/build/repo/build
12:11:59 PM:     publishOrigin: ui
12:11:59 PM: Caching artifacts
12:11:59 PM: Started saving node modules
12:11:59 PM: Finished saving node modules
12:11:59 PM: Started saving build plugins
12:11:59 PM: Finished saving build plugins
12:11:59 PM: Started saving pip cache
12:11:59 PM: Finished saving pip cache
12:11:59 PM: Started saving emacs cask dependencies
12:11:59 PM: Finished saving emacs cask dependencies
12:11:59 PM: Started saving maven dependencies
12:11:59 PM: Finished saving maven dependencies
12:11:59 PM: Started saving boot dependencies
12:11:59 PM: Finished saving boot dependencies
12:11:59 PM: Started saving rust rustup cache
12:11:59 PM: Finished saving rust rustup cache
12:11:59 PM: Started saving go dependencies
12:11:59 PM: Finished saving go dependencies
12:12:02 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:12:02 PM: Creating deploy upload records
12:12:02 PM: Failing build: Failed to build site
12:12:02 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:12:02 PM: Finished processing build request in 1m3.721769069s

Hi @NicolaiHygino,

Could you try this:

1 Like