gaearon / gaearon/react-hot-loader

npm test gives error - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

Open
#1,053 1 comment 3 reactions 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
12.2k
Forks
775
PR merge metrics
No merged PRs in 30d

Description

### Description

Including react-hot-loader to create-react-app without ejecting - Followed [this guide to implement ](https://daveceddia.com/hot-reloading-create-react-app/)

After running ``npm test`` (which runs the default test of create-react-app) getting the below

```
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
```

This [github issue page](https://github.com/timarney/react-app-rewired/issues/170#issuecomment-354516034) - talks about - "The issue is not actually caused by react-app-rewired, but due to a problem with the mismatch in versions between jest-cli and babel-jest." - But I understand if using CRA, I can not update Jest manually.

Have also gone throught [this stackOverflow question](https://stackoverflow.com/questions/46220674/jest-typeerror-path-must-be-a-string-received-undefined) question and did ``npm install jest@latest --save-dev`` - But that didn't help.

What you are reporting:

bug

### Environment

After running ``npm ls jest-environment-node``

```
`-- react-scripts@1.1.5
`-- jest@20.0.4
`-- jest-cli@20.0.4
`-- jest-config@20.0.4
`-- jest-environment-node@20.0.3
```

my package.json

```
{
"name": "redux-boilerplate-base-counter-without-ejecting",
"version": "0.1.0",
"private": true,
"dependencies": {
"babel-jest": "^23.4.2",
"enzyme": "^3.5.0",
"enzyme-adapter-react-16": "^1.3.0",
"node-sass-chokidar": "^1.3.3",
"react": "^16.4.2",
"react-app-rewire-hot-loader": "^1.0.1",
"react-app-rewired": "^1.5.2",
"react-dom": "^16.4.2",
"react-hot-loader": "^4.3.5",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.5",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"test": "^0.6.0"
},
"scripts": {
"build-css": "node-sass-chokidar src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject"
}
}

```

Run these commands in the project folder and fill in their results:

1. `node -v`: v10.1.0
2. `npm -v`: 5.6.0

Then, specify:

1. Operating system: Ubuntu 16:04
2. Browser and version: Chrome Version 68.0.3440.106 (Official Build) (64-bit)

### Reproducible Demo

[https://codesandbox.io/s/qq9w7709xq](https://codesandbox.io/s/528n6w53q4)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.