Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'substring' of undefined #296

Closed
elios264 opened this issue Jul 9, 2019 · 9 comments
Closed

Cannot read property 'substring' of undefined #296

elios264 opened this issue Jul 9, 2019 · 9 comments

Comments

@elios264
Copy link

elios264 commented Jul 9, 2019

  • Operating System: Mac
  • Node Version: 12.4
  • NPM Version: 6.10
  • webpack Version: 4.35.2
  • less-loader Version: 5.0.0

Expected Behavior

Compile without problems

Actual Behavior

Magic error that disappears when recompiling:

Code


  Webpack compilation failed (client)

    ERROR in ./theme/theme.client.less
    Module build failed (from ../node_modules/mini-css-extract-plugin/dist/loader.js):
    ModuleBuildError: Module build failed (from ../node_modules/less-loader/dist/cjs.js):


    Cannot read property 'substring' of undefined
          in undefined (line undefined, column undefined)
        at /Users/elios264/Desktop/alto/promo-panel/node_modules/webpack/lib/NormalModule.js:302:20
        at /Users/elios264/Desktop/alto/promo-panel/node_modules/loader-runner/lib/LoaderRunner.js:367:11
        at /Users/elios264/Desktop/alto/promo-panel/node_modules/loader-runner/lib/LoaderRunner.js:233:18
        at context.callback (/Users/elios264/Desktop/alto/promo-panel/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
     @ ./client/appLoader.js 10:0-33
     @ multi webpack-hot-middleware/client?dynamicPublicPath=true react-hot-loader/patch ./client/appLoader
    ERROR in ./src/theme/theme.client.less (./node_modules/css-loader/dist/cjs.js??ref--5-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-3!./src/theme/theme.client.less)
    Module build failed (from ../node_modules/less-loader/dist/cjs.js):
    
    
    Cannot read property 'substring' of undefined
          in undefined (line undefined, column undefined)

How Do We Reproduce?

it happens half the time, probably a race condition because, if I save any file (so webpack recompiles), it will recompile fine, in a larger project I have happens everytime and I have to force webpack to recompile

related:
webpack-contrib/mini-css-extract-plugin#421

@jasonverber
Copy link

+1, this has been the bane of my existence the past two or three weeks. Very intermittent, but unfortunately it always seems to rear its head during automated build tests (less often during local development.)

@alexander-akait
Copy link
Member

PR welcome

@jasonverber
Copy link

Disabling sourcemaps seems to avoid this altogether.

@jasonverber
Copy link

I believe this is actually an issue with less itself: less/less.js#3360

@alexander-akait
Copy link
Member

Thanks for link

@cap-Bernardito
Copy link
Member

Please upgrade less package to the latest version.

@saddampojee
Copy link

Thanks. Upgrading less package to the latest version solves the problem.

@ronmi-tr
Copy link

hi
am working in a big project with a many developers
and i am the only one getting this error

ERROR in Module build failed (from ./node_modules/less-loader/dist/cjs.js):

Cannot read property 'substring' of undefined
in undefined (line undefined, column undefined)
i updated to latest less loader version and i got some new errors

@alexander-akait
Copy link
Member

@ronmi-tr please create reproducible test repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants