Home
Support Forums

Could not find a required file. Name: index.js - unsuccessful deploy

The site directory is https://hardcore-edison-dcfd9d.netlify.app/ however it will not work due to an unsuccessful deployment.

My index.js is located inside of my client/src/index.js file.

When trying to deploy I receive this message.

8:01:17 PM: ────────────────────────────────────────────────────────────────
8:01:17 PM: 1. Build command from Netlify app
8:01:17 PM: ────────────────────────────────────────────────────────────────
8:01:17 PM: ​
8:01:17 PM: $ npm run build
8:01:18 PM: > scheduler-react@0.1.0 build
8:01:18 PM: > react-scripts build
8:01:20 PM: Could not find a required file.
8:01:20 PM: Name: index.js
8:01:20 PM: Searched in: /opt/build/repo/src
8:01:20 PM: ​
8:01:20 PM: ────────────────────────────────────────────────────────────────
8:01:20 PM: “build.command” failed
8:01:20 PM: ────────────────────────────────────────────────────────────────
8:01:20 PM: ​
8:01:20 PM: Error message
8:01:20 PM: Command failed with exit code 1: npm run build
8:01:20 PM: ​
8:01:20 PM: Error location
8:01:20 PM: In Build command from Netlify app:
8:01:20 PM: npm run build
8:01:20 PM: ​
8:01:20 PM: Resolved config
8:01:20 PM: build:
8:01:20 PM: command: npm run build
8:01:20 PM: commandOrigin: ui
8:01:20 PM: publish: /opt/build/repo/build
8:01:20 PM: publishOrigin: ui

I have reviewed this thread and it does not solve my issue.

The project does work successfully on my local browser, but I do receive these warnings in my terminal, which I think may be unrelated to my current issue.

npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.15.4 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})

audited 1987 packages in 10.943s

162 packages are looking for funding
Compiled with warnings.

C:/Users/shane/Desktop/scheduler-react/client/node_modules/process/browser.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:

  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\process\browser.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\react-error-overlay\lib\index.js
  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\process\browser.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\axios\lib\defaults.js

(webpack)/buildin/module.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:

  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\webpack\buildin\module.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loaCompiled with warnings. de-libs-browser

C:/Users/shane/Desktop/scheduler-react/client/node_modules/process/browser.js -oneOf-3!C:\Use
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers: -5-oneOf-3!C:\U

  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\process\browser.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\react-error-overlay\lib\index.js
  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\process\browser.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\axios\lib\defaults.js

(webpack)/buildin/module.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Compiled with warnings.

C:/Users/shane/Desktop/scheduler-react/client/node_modules/process/browser.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:

  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\process\browser.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\react-error-overlay\lib\index.js
  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\process\browser.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\axios\lib\defaults.js

(webpack)/buildin/module.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:

  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\webpack\buildin\module.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\Desktop\scheduler-react\client\node_modules\node-libs-browser\node_modules\punycode\punycode.js
  • C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\webpack\buildin\module.js
    Used by 1 module(s), i. e.
    C:\Users\shane\Desktop\scheduler-react\client\node_modules\babel-loader\lib\index.js??ref–5-oneOf-3!C:\Users\shane\desktop\scheduler-react\client\node_modules\moment\moment.js

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

Any suggestions to resolve this would be greatly appreciated.

Hi @Rinzler8806

The above is expecting to see the src directory in the root of your repository.

If the src directory is inside the sub-directory client (meaning /opt/build/repo/client/src) then you might need to look at changing the base directory as per the Build from a subdirectory or monorepo docs.

I had created my json file in the root directory. Once I deleted my json file and node_modules directory out of the root I was able to move past the current prompt. However, I am running into a new issue

1 Like

Hi there, @Rinzler8806 :wave:

Thanks for confirming that deleting the json file and node_modules directory out of the root worked for this.

Is the new issue you are referencing the one you describe in this thread: Failed during stage 'building site': Invalid filename ' '. Deployed filenames cannot contain # or ? characters - #5 by Rinzler8806?

If so, let me know and I will close the current one that we are on. Thank you!