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

webpack-cli init doesn't install webpack, uglifyjs-webpack-plugin, babel-preset-es2015 #135

Closed
nilliams opened this issue May 12, 2017 · 4 comments

Comments

@nilliams
Copy link
Contributor

Do you want to request a feature or report a bug?
Bug

What is the current behavior?

$ webpack-cli init

Insecure about some of the questions?

https://github.com/webpack/webpack-cli/blob/master/INIT.md

? Will you be creating multiple bundles? No
? Which module will be the first to enter the application? index.js
? Which folder will your generated bundles be in? [default: dist]:
? Are you going to use this in production? No
? Will you be using ES2015? Yes
? Will you use one of the below CSS solutions? No
? If you want to bundle your CSS files, what will you name the bundle? (press enter to skip)
? Name your 'webpack.[name].js?' [default: 'config']:
...
├─┬ babel-core@6.24.1
│ ├─┬ babel-code-frame@6.22.0
│ │ ├─┬ chalk@1.1.3
...
└── UNMET PEER DEPENDENCY webpack@2

Then:

$ webpack-cli
module.js:471
    throw err;
    ^

Error: Cannot find module 'webpack'

If install webpack (npm i -S webpack), next error is:

$ webpack-cli
module.js:471
    throw err;
    ^

Error: Cannot find module 'uglifyjs-webpack-plugin'

If install that, we get (after fixing "./dist" is not an absolute path which is I see is fixed now):

$ webpack-cli
Hash: 5492c18c1852ed5bd45b
Version: webpack 2.5.1
Time: 3144ms
         Asset     Size  Chunks             Chunk Names
main.bundle.js  1.99 kB       0  [emitted]  main
   [0] ./index.js 1.49 kB {0} [built] [failed] [1 error]

ERROR in ./index.js
Module build failed: Error: Couldn't find preset "es2015" relative to directory

What is the expected behavior?

webpack-cli init to install all needed deps

Version

$ webpack-cli --version
1.3.1
@evenstensberg
Copy link
Member

Hi! The dist output is fixed in #125 . It should install your dependencies, what's your repository structure, and where do you run the command from?

@nilliams
Copy link
Contributor Author

Hmm, it does seem odd no-one else has hit this!

Thought it might be an env thing, so now tried in 2 envs, (empty dir each time):

  • 2 x in MacOS
  • 2 x in Ubuntu (via Vagrant)

... and get the same.

Dir structure is a new, empty dir. I am running command from a global install (npm i -g webpack-cli).

MacOS:

$ which webpack-cli
/Users/nick/.nvm/versions/node/v6.9.5/bin/webpack-cli

Ubuntu:

$ which webpack-cli
/home/vagrant/.nvm/versions/node/v6.9.1/bin/webpack-cli

Here's a more complete dump from the Vagrant attempt, which shows the 3 modules I named not being included in the install.

@nilliams
Copy link
Contributor Author

nilliams commented May 12, 2017

Edit: See PR below which fixes 2 of the 3 missing packages.

As for babel-preset-2015, it looks like you're installing babel-preset-env, (perhaps intended to migrate to that?) but then the config generated tries to use presets: ['es2015'] instead?

@evenstensberg
Copy link
Member

Hi! Thanks for the PR, saw the typo! Closing #136

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

2 participants