Module not found error

I had problems deploying a recent commit that I would appreciate some insight on.

Here is the log :

Cloning from https://github.com/MDouglas345/roargame-threejs...
Jan 20 10:42:45 PM  ==> Checking out commit 29a7284bff92c50766b0bf08855d4e0b4c5b9ec1 in branch main
Jan 20 10:42:51 PM  ==> Installing dependencies with npm...
Jan 20 10:43:04 PM  updated 378 packages and audited 379 packages in 12.836s
Jan 20 10:43:05 PM  
Jan 20 10:43:05 PM  57 packages are looking for funding
Jan 20 10:43:05 PM    run `npm fund` for details
Jan 20 10:43:05 PM  
Jan 20 10:43:05 PM  found 0 vulnerabilities
Jan 20 10:43:05 PM  
Jan 20 10:43:07 PM  audited 379 packages in 2.254s
Jan 20 10:43:08 PM  
Jan 20 10:43:08 PM  57 packages are looking for funding
Jan 20 10:43:08 PM    run `npm fund` for details
Jan 20 10:43:08 PM  
Jan 20 10:43:08 PM  found 0 vulnerabilities
Jan 20 10:43:08 PM  
Jan 20 10:43:17 PM  ==> Using Python version: 3.7.10
Jan 20 10:43:21 PM  ==> Running build command 'npm run build'...
Jan 20 10:43:21 PM  
Jan 20 10:43:21 PM  > roargame-threejs@1.0.0 build /opt/render/project/src
Jan 20 10:43:21 PM  > webpack
Jan 20 10:43:21 PM  
Jan 20 10:43:24 PM  asset index.js 1.36 MiB [emitted] (name: main)
Jan 20 10:43:24 PM  asset index.html 321 bytes [compared for emit]
Jan 20 10:43:24 PM  runtime modules 972 bytes 5 modules
Jan 20 10:43:24 PM  modules by path ./src/ 32 KiB 24 modules
Jan 20 10:43:24 PM  modules by path ./node_modules/ 1.14 MiB
Jan 20 10:43:24 PM    modules by path ./node_modules/style-loader/dist/runtime/*.js 5.75 KiB 6 modules
Jan 20 10:43:24 PM    modules by path ./node_modules/css-loader/dist/runtime/*.js 2.31 KiB
Jan 20 10:43:24 PM      ./node_modules/css-loader/dist/runtime/noSourceMaps.js 64 bytes [built] [code generated]
Jan 20 10:43:24 PM      ./node_modules/css-loader/dist/runtime/api.js 2.25 KiB [built] [code generated]
Jan 20 10:43:24 PM    ./node_modules/three/build/three.module.js 1.12 MiB [built] [code generated]
Jan 20 10:43:24 PM    ./node_modules/nipplejs/dist/nipplejs.js 19.8 KiB [built] [code generated]
Jan 20 10:43:24 PM  
Jan 20 10:43:24 PM  ERROR in ./src/index.js 10:0-69
Jan 20 10:43:24 PM  Module not found: Error: Can't resolve './Controller/keyboardcontroller.js' in '/opt/render/project/src/src'
Jan 20 10:43:24 PM  resolve './Controller/keyboardcontroller.js' in '/opt/render/project/src/src'
Jan 20 10:43:24 PM    using description file: /opt/render/project/src/package.json (relative path: ./src)
Jan 20 10:43:24 PM      Field 'browser' doesn't contain a valid alias configuration
Jan 20 10:43:24 PM      using description file: /opt/render/project/src/package.json (relative path: ./src/Controller/keyboardcontroller.js)
Jan 20 10:43:24 PM        no extension
Jan 20 10:43:24 PM          Field 'browser' doesn't contain a valid alias configuration
Jan 20 10:43:24 PM          /opt/render/project/src/src/Controller/keyboardcontroller.js doesn't exist
Jan 20 10:43:24 PM        .js
Jan 20 10:43:24 PM          Field 'browser' doesn't contain a valid alias configuration
Jan 20 10:43:24 PM          /opt/render/project/src/src/Controller/keyboardcontroller.js.js doesn't exist
Jan 20 10:43:24 PM        .json
Jan 20 10:43:24 PM          Field 'browser' doesn't contain a valid alias configuration
Jan 20 10:43:24 PM          /opt/render/project/src/src/Controller/keyboardcontroller.js.json doesn't exist
Jan 20 10:43:24 PM        .wasm
Jan 20 10:43:24 PM          Field 'browser' doesn't contain a valid alias configuration
Jan 20 10:43:24 PM          /opt/render/project/src/src/Controller/keyboardcontroller.js.wasm doesn't exist
Jan 20 10:43:24 PM        as directory
Jan 20 10:43:24 PM          /opt/render/project/src/src/Controller/keyboardcontroller.js doesn't exist
Jan 20 10:43:24 PM  
Jan 20 10:43:24 PM  webpack 5.75.0 compiled with 1 error in 2069 ms
Jan 20 10:43:24 PM  npm ERR! code ELIFECYCLE
Jan 20 10:43:24 PM  npm ERR! errno 1
Jan 20 10:43:24 PM  npm ERR! roargame-threejs@1.0.0 build: `webpack `
Jan 20 10:43:24 PM  npm ERR! Exit status 1
Jan 20 10:43:24 PM  npm ERR!
Jan 20 10:43:24 PM  npm ERR! Failed at the roargame-threejs@1.0.0 build script.
Jan 20 10:43:24 PM  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Jan 20 10:43:24 PM  
Jan 20 10:43:24 PM  npm ERR! A complete log of this run can be found in:
Jan 20 10:43:24 PM  npm ERR!     /opt/render/.cache/_logs/2023-01-21T05_43_24_392Z-debug.log
Jan 20 10:43:24 PM  ==> Build failed 😞

From what I gather, the line causing the error is in my index.js :

import KeyboardController  from "./Controller/keyboardcontroller.js";

This build occurs without error on my local machine so its something I must’ve fumbled with my webpack.config.js?

I have multiple imports before the line that causes the error but they do not cause errors.

I can provide more information if needed

Hi there

It might up upper/lowercasing problem. In linux filepaths are case-sensitive. Maybe the Controller folder is controller or keyboardcontroller.is should be KeyboardController.js


Sorry for the screenshot but this is just a sanity test to make sure Im not making a dumb error somewhere.

My cases appear to be correct?

I will say that the file keyboardcontroller.js was KeyboardController.js but I changed it to stay consistent with my file formatting.

So after changing redoing the import for keyboard controller, VSCode auto imported it as import KeyboardController from './Controller/KeyboardController'; Which confuses me endlessly.

Now the error for the keyboard controller has gone away, the new error is with the import right after it, the JoystickController.

Anyone has an explanation on how this could happen?

Hi,

It sounds like you’re describing casing issues. Linux (as used by Render) has a case-sensitive filename. The code and filesystem need to match. If you import ./Controller/KeyboardController, the file folder needs a capital C and the filename a capital K & C.

Alan

Thank you for the response,

I double checked the cases, and you can see from the screenshot I sent that they appear to be correct. The thing that VSCode auto imports is technically correct because it works, but! The directory and file names do not match what the import details, hence my confusion.

It’ll may be more about what Git has stored, changes in file casing don’t always get picked up. Maybe check the file casing in GitHub.

Alan

This was the problem. Im not sure how it happened, but there was inconsistent naming with the keyboardcontroller.js. Even though I was pushing changes to this file into the repo, my Git repo had the file named KeyboardController.js while locally on my machine it was being identified as keyboardcontroller.js

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.