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

serve command suddenly stopped working (due to recent version bump?) #2894

Closed
vanbasten17 opened this issue Aug 16, 2021 · 23 comments
Closed
Labels

Comments

@vanbasten17
Copy link

Describe the bug

I assume that after bumping @webpack-cli/serve to 1.5.2 something has been broken, as after adding the following in my package.json, webpack serves correctly as expected.

"resolutions": {
    "@webpack-cli/serve": "1.5.1"
  }

What is the current behavior?

Webpack fails to build on serve.

- configuration has an unknown property '_assetEmittingPreviousFiles'. These properties are valid:
- { bonjour?, client?, compress?, devMiddleware?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, public?, setupExitSignals?, static?, transportMode?, watchFiles? }

To Reproduce

Steps to reproduce the behavior:

I have just done a clean install of one of my projects using the serve command. Suddenly, it stopped working. I have seen that both packages webpack-cli and @webpack-cli/serve have been published recently (14h ago at time of writing this issue).

Expected behavior

Serve should work as expected

Screenshots

Please paste the results of webpack-cli info here, and mention other relevant information

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 1.68 GB / 16.00 GB
  Binaries:
    Node: 12.22.3 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm
  Browsers:
    Chrome: 92.0.4515.131
    Edge: 92.0.902.73
    Firefox: 89.0
    Safari: 14.0.2
  Monorepos:
    Yarn Workspaces: 1.22.10

Additional context

@alexander-akait
Copy link
Member

Remove @webpack-cli/serve, you should not use this directly

@alexander-akait
Copy link
Member

The problem can be due invalid usage of API, we have a lot of integration test, example webpack/webpack-dev-server#3649 and no problems with webpack v4 and webpack v5

@alexander-akait
Copy link
Member

alexander-akait commented Aug 16, 2021

And please always clarify steps:

Steps to reproduce the behavior:

I have just done a clean install of one of my projects using the serve command. Suddenly, it stopped working. I have seen that both packages webpack-cli and @webpack-cli/serve have been published recently (14h ago at time of writing this issue).

Which projects? How you run dev server? What are versions?

@vanbasten17
Copy link
Author

The project I'm trying to run is a monorepo project, that has all the webpack configuration in one of their dependencies node_modules/@botonic/dx/botonic-app-config/ (as you can see here, in the root's package json of this we don't have @webpack-cli/serve specified, so we are not using it directly. To try it, run the following command:
yarn create botonic-app test (after installation, cd into the project and try to run yarn serve).
The versions that appear when executing webpack are the following ones:

node_modules/.bin/webpack --version
webpack 5.50.0
webpack-cli 4.8.0
webpack-dev-server 4.0.0-beta.3

It should not work.
Then try to put the following in test/package.json

"resolutions": {
    "@webpack-cli/serve": "1.5.1"
  }

and works as expected. So I assume that it has to be related in some way with 1.5.2 version of the package.

@alexander-akait
Copy link
Member

alexander-akait commented Aug 16, 2021

Please update 4.0.0-beta.3 to 4.0.0-rc.0 (today we will do rc.1 with more fixes), it is expected, because 4.0.0-beta.3 is not stable

@vanbasten17
Copy link
Author

Thanks a lot @alexander-akait ! It worked 😊

@chillyistkult
Copy link

Does not work for me, even older previously working builds from today and yesterday are not working anymore which is very weird.

@alexander-akait
Copy link
Member

Sorry information is not enough to help you

davidjoy added a commit to openedx/frontend-build that referenced this issue Aug 17, 2021
This updates:

- webpack from 5.44.0 -> 5.50.0
- webpack-cli from 4.7.2 -> 4.8.0
- webpack-dev-server from 4.0.0-beta.3 -> 4.0.0-rc.1

It's the last one that's most interesting.  A bug has emerged in beta.3 which is preventing some of our projects from building correctly.  See comments here: webpack/webpack-cli#2894 (comment)
@AB3000
Copy link

AB3000 commented Feb 16, 2024

@chillyistkult @alexander-akait Did you ever find a fix by any chance? I'm facing the same issue when upgrading to webpack 5.0.1.

I was previously on webpack 4.0.0

    OS: Linux 6.1 Amazon Linux 2023
    CPU: (2) x64 Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
    Memory: 3.21 GB / 7.63 GB
  Binaries:
    Node: 18.12.1 - /usr/bin/node
    npm: 8.19.2 - /usr/bin/npm
  Browsers:
    Chrome: 120.0.6099.224
  Packages:
    awesome-typescript-loader: ^5.2.1 => 5.2.1 
    babel-loader: ^8.2.2 => 8.3.0 
    css-loader: ^6.7.1 => 6.10.0 
    dotenv-webpack: ^7.0.1 => 7.1.1 
    loader-utils: ^3.2.1 => 3.2.1 
    postcss-loader: ^7.0.1 => 7.3.4 
    speed-measure-webpack-plugin: ^1.5.0 => 1.5.0 
    string-replace-loader: ^3.1.0 => 3.1.0 
    style-loader: ^3.3.1 => 3.3.4 
    ts-loader: ^9.4.1 => 9.5.1 
    tsconfig-paths-webpack-plugin: ^3.5.1 => 3.5.2 
    webpack: ^5.90.2 => 5.90.2 
    webpack-cli: ^5.1.4 => 5.1.4 
    webpack-dev-server: ^5.0.1 => 5.0.1 
    webpack-merge: ^5.8.0 => 5.10.0```
    
 

This is the log I am getting: 
    
` ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. options has an unknown property '_assetEmittingPreviousFiles'. These properties are valid: object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, ipc?, liveReload?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }`
  

@alexander-akait
Copy link
Member

Please update deps to the latest versions, thank you

@dannkkie
Copy link

Using [email protected] [email protected] and all dependencies updated but i still get this '_assetEmittingPreviousFiles' issue

@armoredchimp
Copy link

I just had this issue but it was due to webpack-cli not being updated to the latest version, this fixed it

@dannkkie
Copy link

dannkkie commented Feb 22, 2024

I just had this issue but it was due to webpack-cli not being updated to the latest version, this fixed it

Even though I don't use webpack-cli in my code, I installed it but still had same issue

@alexander-akait
Copy link
Member

@dannkkie Hello, can you provide a reproducible test repo?

@dannkkie
Copy link

@dannkkie Hello, can you provide a reproducible test repo?

This is the specific error message I get
Invalid options object. dev server has been initialized using an options object that does not match the API schema. - options has an unknown property '_assetEmittingPreviousFiles'.

@alexander-akait
Copy link
Member

hm, sounds like you have a mistake with webpack node api

@dannkkie
Copy link

Update i downgraded webpack-dev-server to 4.15.1 and i dont see the error again

@alexander-akait
Copy link
Member

Sorry, your infromation is not helpful, I think you pass the compiler to dev server constructor firstly, but in v5, you need to pass options as a first argument https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L257 and the compiler as second

@dannkkie
Copy link

So i just tried that with the latest version again and I get 'onBeforeSetupMiddleware'

@alexander-akait
Copy link
Member

@dannkkie Please read the migration guide, we have breaking changes between v4 and v5 https://github.com/webpack/webpack-dev-server/blob/master/migration-v5.md

@dannkkie
Copy link

@dannkkie Please read the migration guide, we have breaking changes between v4 and v5 https://github.com/webpack/webpack-dev-server/blob/master/migration-v5.md

This helped...Thanks 😀

@tlequy
Copy link

tlequy commented Feb 27, 2024

Hi Everyone,
Having some issues too.

Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.

  • options has an unknown property '_assetEmittingPreviousFiles'. These properties are valid:
    object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, ipc?, liveReload?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

Using:
[email protected] / [email protected] / [email protected]

Current code:

The issue has been fixed - the key part was the one mentioned by @alexander-akait

Sorry, your infromation is not helpful, I think you pass the compiler to dev server constructor firstly, but in v5, you need to pass options as a first argument https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L257 and the compiler as second

@jamidwyer
Copy link

I just ran into the _assetEmittingPreviousFiles error as well.

I needed to update webpack-cli to 5.1.4.

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

No branches or pull requests

8 participants