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

Clean installation of preact-cli fails to build #252

Closed
filoxo opened this issue Jul 23, 2017 · 5 comments · Fixed by #253
Closed

Clean installation of preact-cli fails to build #252

filoxo opened this issue Jul 23, 2017 · 5 comments · Fixed by #253

Comments

@filoxo
Copy link

filoxo commented Jul 23, 2017

I was working on upgrading to the latest version last night to debug a separate problem and decided to go ahead and update from 1.3.0 to 1.4.0, as well as a totally new install on a fresh install of node.

node -v: v6.9.5
npm -v: 5.1.0
preact -v: preact-cli 1.4.0 (upgraded from 1.3.0)


node -v: v8.2.1
npm -v: 5.3.0
preact -v: preact-cli 1.4.0 (new install)

I generated a new project using create. Build fails with error:

Build failed!

(webpack)-dev-server/client?http://0.0.0.0:8080/
Module not found: Error: Can't resolve 'loglevel' in '/Users/me/dev/preact-cli-test/node_modules/webpack-dev-server/client'
 @ (webpack)-dev-server/client?http://0.0.0.0:8080/ 4:10-29
 @ multi ./~/preact-cli/lib/lib/entry webpack-dev-server/client?http://0.0.0.0:8080/ webpack/hot/dev-server?http://0.0.0.0:8080/

Seems to be a bug in webpack-dev-server (webpack/webpack-dev-server#984). Supposedly, falling back to old versions would work but one user reported still seeing the error while using 2.4.2 (so slightly older than this project's dep 2.4.5). That would suggest that that bug is also affecting this project. If that issue is as pervasive as it seems, this may affect every new installation.

Workaround

Fortunately the workaround is to simply install loglevel on your own project, until preact-cli upgrades.

npm i -D loglevel or yarn add -D loglevel

Solution

In the long term, preact-cli probably needs to upgrade to webpack-dev-server +2.6.0 but I'll leave that to the team to further analyze and see if its compatible.

@reznord
Copy link
Member

reznord commented Jul 23, 2017

Can you try re-installing the node_modules?

@filoxo
Copy link
Author

filoxo commented Jul 23, 2017

Sorry if that wasn't clear. I've deleted all of node_modules (several times), reinstalled, and also created a brand new project from a totally clean node install. Same results in both cases.

Edit: now that I think about it, reinstalling node_modules to the local project probably isn't the problem nor solution. The globally installed preact-cli is where the issue lies, since npm start calls preact watch or preact build. Uninstalling and reinstalling globally should be the repo case.

@developit
Copy link
Member

I've seen this reported elsewhere too - I wonder what is installing loglevel?

@filoxo
Copy link
Author

filoxo commented Jul 23, 2017

@developit its a webpack-dev-server dependency that at some point got moved to devDependencies and published(?). Not sure how that affected old versions–making fallback versions not work–but the issue I linked to in the first comment has further details/dicussion. Its fixed with webpack-dev-server@2.6.0 so maybe its as easy as updating to that?

@developit
Copy link
Member

Sounds about right!

reznord added a commit that referenced this issue Jul 23, 2017
@reznord reznord mentioned this issue Jul 23, 2017
reznord added a commit that referenced this issue Jul 23, 2017
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

Successfully merging a pull request may close this issue.

3 participants