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 'length' of null #542

Closed
IzaGz opened this issue Jul 9, 2018 · 14 comments
Closed

Cannot read property 'length' of null #542

IzaGz opened this issue Jul 9, 2018 · 14 comments

Comments

@IzaGz
Copy link

IzaGz commented Jul 9, 2018

./node_modules/webpack-cli/bin/webpack.js migrate webpack.config.js 
? Migration output path not specified. Do you want to use your existing webpack configuration? Yes
 ✔ Reading webpack config
 ❯ Migrating config to newest version
   ✔ loadersTransform
   ✔ resolveTransform
   ✔ removeJsonLoaderTransform
   ✖ uglifyJsPluginTransform
     → Cannot read property 'length' of null
     loaderOptionsPluginTransform
     bannerPluginTransform
     extractTextPluginTransform
     noEmitOnErrorsPluginTransform
     removeDeprecatedPluginsTransform

 ✖ ︎Migration aborted due to some errors: 

{ TypeError: Cannot read property 'length' of null
    at NodePath.rootNode.find.forEach.node (/Users/z/project/node_modules/webpack-cli/lib/utils/ast-utils.js:78:16)
    at __paths.forEach (/Users/z/project/node_modules/jscodeshift/src/Collection.js:76:36)
    at Array.forEach (native)
    at Collection.forEach (/Users/z/project/node_modules/jscodeshift/src/Collection.js:75:18)
    at findPluginsArrayAndRemoveIfEmpty (/Users/z/project/node_modules/webpack-cli/lib/utils/ast-utils.js:71:58)
    at module.exports (/Users/z/project/node_modules/webpack-cli/lib/migrate/uglifyJsPlugin/uglifyJsPlugin.js:120:2)
    at Timeout.err [as _onTimeout] (/Users/z/project/node_modules/webpack-cli/lib/migrate/index.js:37:13)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
  context: 

@evenstensberg
Copy link
Member

Hi @IzaGz , could you use the issue template that is provided next time? Which version are you on?

@evenstensberg
Copy link
Member

Moved to #541

@IzaGz
Copy link
Author

IzaGz commented Jul 10, 2018

@ev1stensberg i was on 2.1.1 but got this error #541
then i moved to 1.2.0 and got this error with length

@evenstensberg
Copy link
Member

Could you move to the latest version? It should be no problem for you

@IzaGz
Copy link
Author

IzaGz commented Jul 10, 2018

@ev1stensberg i use webpack 2 i am migrating from webpack 1 to 2
i see this library for migrationg from 1 to 2 only. But why i see this error?
webpack-cli@2.1.5 requires a peer of webpack@^4.0.0 but none was installed.

@evenstensberg
Copy link
Member

What happens if you run the newest version? Any errors? Ignore those warnings for now

@IzaGz
Copy link
Author

IzaGz commented Jul 11, 2018

@ev1stensberg if i run with webpack-cli 3.0.8 i got error
#541
`node node_modules/webpack-cli/bin/cli.js migrate webpack.config.js
/Users/z/project/src/_mobile/node_modules/@webpack-cli/migrate/index.js:11
const { validate } = process.webpackModule;
^

TypeError: Cannot destructure property validate of 'undefined' or 'null'.
at Object. (/Users/z/project/src/_mobile/node_modules/@webpack-cli/migrate/index.js:11:30)
at Module._compile (/Users/z/project/src/_mobile/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (/Users/z/project/src/_mobile/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at promptForInstallation (/Users/z/project/src/_mobile/node_modules/webpack-cli/bin/prompt-command.js:108:3)
at /Users/z/project/src/_mobile/node_modules/webpack-cli/bin/cli.js:45:37
`

@evenstensberg
Copy link
Member

Try v.3.2 and up. Just upgrade to the latest, that's the easiest way to get the error gone.

@IzaGz
Copy link
Author

IzaGz commented Jul 11, 2018

@ev1stensberg but where can i found the list of versions? in the https://github.com/webpack/webpack-cli/releases page only 3.0.8 last
i tried npm i -S webpack-cli@latest - I thought this will install the latest version...
How could i now the real latest version?

@evenstensberg
Copy link
Member

npm uninstall webpack-cli && npm install --save-dev webpack-cli@latest

@IzaGz
Copy link
Author

IzaGz commented Jul 12, 2018

@ev1stensberg it installs 3.0.8 version

@evenstensberg
Copy link
Member

Could you check with version is the latest one in Npm? Try to install rhat. There's no breaking things CLI wise for you to be stuck at updating the dependency

@mayanksingh0821
Copy link

Issue is still present with webpack-cli 3.1.2, why is this issue closed?

@ematipico
Copy link
Contributor

File a new issue please. The source of the problem could be different

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

No branches or pull requests

4 participants