无效的配置对象:webpack.server.js

时间:2019-01-08 16:39:52

标签: webpack-dev-server

我正在使用此webpack文件,但出现错误。

这是webpack文件:

Invalid configuration object. Webpack has been initialised using a 
    configuration object that does not match the API schema.
    - configuration.context: The provided value 
    "C:\\Users\\}\\Desktop\\Node\\HelloWorld!\\new" contains exclamation mark 
    (!) which is not allowed because it's reserved for loader syntax.
    -> The base directory (absolute path!) for resolving the `entry` option. If 
    `output.pathinfo` is set, the included pathinfo is shortened to this 
    directory.
    - configuration.output.path: The provided value 
    "C:\\Users\\}\\Desktop\\Node\\HelloWorld!\\new\\build" contains
    exclamation mark (!) which is not allowed because it's reserved for loader 
     syntax.
    -> The output directory as **absolute path** (required).
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! new@1.0.0 dev:build:server: `webpack --config 
        webpack.server.js`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the new@1.0.0 dev:build:server script.
        npm ERR! This is probably not a problem with npm. There is likely 
        additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\}\AppData\Roaming\npm-cache\_logs\2019-01- 
08T16_11_48_069Z-debug.log

这是错误消息:

{{1}}

1 个答案:

答案 0 :(得分:1)

有相同的错误。问题似乎出在您文件夹的路径中。它不能包含感叹号(!)。 更改文件夹“ HelloWorld!”只是没有感叹号的“ HelloWorld”。

希望这可以解决问题。