Webpack-cli: [BUG]: 馃悶init throws "A name parameter is required to create a storage"

Created on 30 May 2019  路  9Comments  路  Source: webpack/webpack-cli

Describe the bug

Executing webpack-cli init in a folder where there is a package.json results in an unclear error

What is the current behavior?

webpack-cli init
assert.js:345
    throw err;
    ^

AssertionError [ERR_ASSERTION]: A name parameter is required to create a storage
    at new Storage (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/yeoman-generator/lib/util/storage.js:24:5)
    at InitGenerator._getStorage (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/yeoman-generator/lib/index.js:618:12)
    at new Generator (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/yeoman-generator/lib/index.js:148:24)
    at new InitGenerator (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/@webpack-cli/generators/init-generator.js:23:9)
    at Environment.instantiate (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/yeoman-environment/lib/environment.js:429:12)
    at Environment.create (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/yeoman-environment/lib/environment.js:407:17)
    at Environment.run (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/yeoman-environment/lib/environment.js:464:28)
    at Object.modifyHelperUtil [as default] (/usr/local/lib/node_modules/@webpack-cli/init/node_modules/@webpack-cli/utils/modify-config-helper.js:59:9)
    at initializeInquirer (/usr/local/lib/node_modules/@webpack-cli/init/index.js:19:46)
    at runWhenInstalled (/Users/devid/Workspace/OSS/testlog/node_modules/webpack-cli/bin/utils/prompt-command.js:46:9)

To Reproduce
Steps to reproduce the behavior:
This error occurs if you try to run webpack-cli init on a project that has already been bootstrapped. We need to support bootstrapping multiple times, run the init command two times.

Expected behavior
I expect it to work unless I already have a webpack.config.js in the same folder. Anyway it should give a more clear error

Up for grabs

Bug Good First Contribution

All 9 comments

Its working fine with me.
the scenarios I tested

  • With package.json present alone
  • With webpack.config.js present alone
  • With both present
    It is working in my system. Is there any other step to reproduce it.

@misterdev record on yoututbe and put out a link if you can. Also, focus on your gsoc proposal ;)

This error occurs if you try to run webpack-cli init on a project that has already been bootstrapped. We need to support bootstrapping multiple times, run the init command two times. Up for grabs

I am facing this now!
Getting this even running the npx webpack-cli init twice still the same. I actually didn't get this why it's happening?

cc @evenstensberg

PS : deleting package.json (created by the generator ) is working fine !
Should we check for the presence of package.json before running the generator ?

Probbaly cause files are already there when running twice

Probbaly cause files are already there when running twice

yeah thats what....cant we check in init command befor running it that whether its there or not and if its there then show the message or delete it....befor generating

I don't know, you'll need to do some research and prove it works

to do some research and prove it works

yeah sure! I will do it by the weekend ! 馃憤

Its working fine with me
First created package.json

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aleksandrlat picture aleksandrlat  路  3Comments

evenstensberg picture evenstensberg  路  5Comments

jbottigliero picture jbottigliero  路  5Comments

sumukhah picture sumukhah  路  3Comments

fokusferit picture fokusferit  路  5Comments