question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to develop with react-hooks (react@16.7.0-alpha) - Uncaught Error: Module build failed (from ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js):

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

1.10.1

Which terms did you search for in User Guide?

Uncaught Error: Module build failed (from ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js):

Environment

npx: installed 63 in 11.394s

Environment Info: (node:1363) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘1’ of null at a.run.then.e (/root/.npm/_npx/1363/lib/node_modules/create-react-app/node_modules/envinfo/dist/envinfo.js:1:97255) (node:1363) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:1363) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Steps to Reproduce

(Write your steps here:)

  1. run yarn
  2. browse app
  3. check console

Expected Behavior

App was running perfectly before with the same package.json setup and the same exact code, nothing has been changed, only ran a fresh modules installation and then everything broke, re-installing the node_modules was the only change that has been made, before that app was working, after that, app is not working.

Actual Behavior

I get the following error:

Uncaught Error: Module build failed (from ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js):
Uncaught Error: Module build failed (from ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js):
Error: ENOENT: no such file or directory, open '/src/node_modules/debug/src/debug.js'
    at Object../node_modules/debug/src/debug.js (browser.js:157)
    at __webpack_require__ (bootstrap:782)
    at fn (bootstrap:150)
    at Object.<anonymous> (browser.js:6)
    at Object../node_modules/debug/src/browser.js (browser.js:157)
    at __webpack_require__ (bootstrap:782)
    at fn (bootstrap:150)
    at Object../node_modules/sockjs-client/lib/utils/url.js (url.js:8)
    at __webpack_require__ (bootstrap:782)
    at fn (bootstrap:150)

this is my package.json file:

{
  "name": "wms-pickit",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/icons": "^3.0.1",
    "classnames": "^2.2.6",
    "husky": "^1.2.0",
    "lint-staged": "^8.1.0",
    "lodash": "^4.17.11",
    "node-sass": "^4.10.0",
    "prettier": "^1.15.2",
    "react": "^16.7.0-alpha.2",
    "react-dom": "^16.7.0-alpha.2",
    "react-router-dom": "^4.3.1",
    "react-scripts": "2.1.1",
    "typeface-roboto": "0.0.54",
    "uuid": "^3.3.2",
    "serve": "^10.1.1"
  },
  "scripts": {
    "start": "PORT=8080 react-scripts start",
    "build": "react-scripts build",
    "serve": "serve -s -p 8080 build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "@material-ui/core": "^3.5.1"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
   "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
     "prettier --single-quote --write",
     "git add"
   ]
 }
}

I created a test app to help with debugging, here’s the repo: https://github.com/therayess/CRA_DEBUG

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Timercommented, Dec 24, 2018

@gusthliv you need to add 16.7.0-alpha.2, not ^16.7.0-alpha.2. The behavior you are experiencing has nothing to do with Create React App.

1reaction
therayesscommented, Dec 24, 2018

@Timer my bad, it did work, had to re-install container and clear cache then all worked. Thanks! gonna close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
I am trying to learn React. I am trying to display the string Hello World but get the following error in my browser:...
Read more >
Introducing Hooks - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. ... This...
Read more >
React Stripe.js reference | Stripe Documentation
Want to see how React Stripe.js works or help develop it? ... The easiest way to initialize a Stripe object is with the...
Read more >
babel/preset-react
And with the development option: ... or @babel/plugin-transform-react-jsx-source will error. ... babel --presets @babel/preset-react script.js.
Read more >
@testing-library/react-hooks - npm
The problem. You're writing an awesome custom hook and you want to test it, but as soon as you call it you see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found