webpack icon indicating copy to clipboard operation
webpack copied to clipboard

"TypeError: Path must be a string" after break from project

Open kingscott opened this issue 10 years ago • 55 comments

I updated packages and all seemed fine. I took a week break from the project, ran npm install and cannot seem to figure out the cause of this error. It's on this repo.

For convenience here is the error message and specs:

ERROR in ./src/app.js
Module build failed: TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.extname (path.js:1429:5)
    at processText (/home/kingscott/newton/node_modules/standard/node_modules/eslint/lib/cli-engine.js:144:30)
    at CLIEngine.executeOnText (/home/kingscott/newton/node_modules/standard/node_modules/eslint/lib/cli-engine.js:671:26)
    at Linter.lintText (/home/kingscott/newton/node_modules/standard-engine/index.js:65:59)
    at Object.standardLoader (/home/kingscott/newton/node_modules/standard-loader/index.js:19:12)
 @ multi app

and my packages:

"dependencies": {
    "material-ui": "^0.15.0-alpha.2",
    "react": "^15.0.2",
    "react-dom": "^15.0.2",
    "react-tap-event-plugin": "^1.0.0",
    "recompose": "^0.17.0"
  },
  "engines": {
    "node": "0.12.7"
  },
  "devDependencies": {
    "babel": "^5.8.21",
    "babel-core": "^5.8.22",
    "babel-loader": "^5.3.2",
    "standard": "^6.0.8",
    "standard-loader": "^3.0.0",
    "webpack": "^1.13.0",
    "webpack-dev-server": "^1.14.1"
  }

If you check out the repo, you can see my server.js and webpack.config.js.

Thanks.

kingscott avatar May 10 '16 00:05 kingscott

Could you try upgrading to standard 7? Feels like a standard related bug to me.

bebraw avatar May 10 '16 03:05 bebraw

The error persists. I've swapped out some of my code (new build processes for old etc), updated/downgraded packages. And not sure what it is.

kingscott avatar May 10 '16 03:05 kingscott

Ok. The next step would be digging into ESLint. Maybe logging near the offending line would give better insight. It might stem from standard-loader configuration somehow so that's another place to inspect.

bebraw avatar May 10 '16 03:05 bebraw

Hmm, we'd have to dig into ESLint even if I'm not explicitly using ESLint?

kingscott avatar May 10 '16 04:05 kingscott

See processText at the trace.

bebraw avatar May 10 '16 05:05 bebraw

What command do I have to run to repro? I tried a few, no luck. I see

ERROR in ./src/app.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../backgrounds.js in ../king/src
 @ ./src/app.js 25:21-49

though.

bebraw avatar May 10 '16 05:05 bebraw

I can include that file. I excluded it from source control and would prefer to have it not on GitHub. I can email you the file, and then you would just checkout the nasa-update branch and run:

➜  ~  npm install
➜  ~  npm start

kingscott avatar May 10 '16 13:05 kingscott

Works for me.

king [nasa-update] $ npm start

> [email protected] start .../king
> NODE_ENV=development node server.js

Listening at localhost:2020
Hash: 22dd0f5206c2641317ba
Version: webpack 1.13.0
Time: 3776ms
             Asset     Size  Chunks             Chunk Names
    ./lib/build.js   980 kB       0  [emitted]  app
./lib/build.js.map  1.15 MB       0  [emitted]  app
chunk    {0} ./lib/build.js, ./lib/build.js.map (app) 924 kB [rendered]

WARNING in ./src/app.js
<text>:22:8: Closing curly brace does not appear on the same line as the subsequent block.
webpack: bundle is now VALID.

Maybe I'm missing something. Running on OS X so that could be it. There's some difference.

bebraw avatar May 10 '16 13:05 bebraw

If you navigate to localhost:2020 what do you get?

kingscott avatar May 10 '16 13:05 kingscott

It shows some photo background and time(?) then.

bebraw avatar May 10 '16 13:05 bebraw

Hmm weird. I was getting the same error on OS X as well as Linux.

kingscott avatar May 10 '16 13:05 kingscott

It's really hard for me to say anything concrete. You would have to look at the stack trace and go from there. Perhaps someone else can repro.

In any case, this might fit Stack Overflow better as it seems the issue is somewhere else than webpack core.

bebraw avatar May 10 '16 13:05 bebraw

I am slightly confused as to why you cannot replicate the bug, what version of node and npm are you running?

kingscott avatar May 10 '16 13:05 kingscott

king [nasa-update] $ node -v
v5.10.1
king [nasa-update] $ npm -v
3.8.3

bebraw avatar May 10 '16 13:05 bebraw

I've seen some weird Node 6 reports so maybe that's it?

bebraw avatar May 10 '16 13:05 bebraw

Must be a node problem. Downgraded to node 5.11.1 and it works. Thanks for the help, you can close.

:+1:

kingscott avatar May 10 '16 13:05 kingscott

Ok. You could consider reporting this upstream to standard-loader.

bebraw avatar May 10 '16 13:05 bebraw

I'll give it a shot, thanks @bebraw.

kingscott avatar May 10 '16 13:05 kingscott

Had the same issue and no stack trace to help me debug this whatsoever. Downgraded from node 6 to 5 and... success! Thanks!

felix-d avatar May 15 '16 18:05 felix-d

same here 👍

wiiiim avatar May 15 '16 22:05 wiiiim