Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Express 网页包开发服务器语法错误:意外令牌<;在JSON中的位置0_Express_Webpack - Fatal编程技术网

Express 网页包开发服务器语法错误:意外令牌<;在JSON中的位置0

Express 网页包开发服务器语法错误:意外令牌<;在JSON中的位置0,express,webpack,Express,Webpack,我有一个多页的react应用程序,运行时打开了webpack。 当我运行webpack dev server--hot--inline并转到http://localhost:3000/movies,我的组件不呈现,控制台显示 bundle.js:17 SyntaxError: Unexpected token < in JSON at position 0 at Object.<anonymous> (http://localhost:3000/bundle.js:1:

我有一个多页的react应用程序,运行时打开了webpack。 当我运行
webpack dev server--hot--inline
并转到
http://localhost:3000/movies
,我的组件不呈现,控制台显示

bundle.js:17 SyntaxError: Unexpected token < in JSON at position 0
    at Object.<anonymous> (http://localhost:3000/bundle.js:1:47124)
    at w (http://localhost:3000/bundle.js:33:9889)
    at Generator._invoke (http://localhost:3000/bundle.js:33:9677)
    at Generator.e.(anonymous function) [as next] (http://localhost:3000/bundle.js:33:10068)
    at i (http://localhost:3000/bundle.js:1:47400)
    at a (http://localhost:3000/bundle.js:1:47495)
    at <anonymous>

我不知道这是否只是一个json问题,react应用程序没有直接“需要”。json文件,它正在从节点请求一个json响应。

react执行
fetch
实际上得到了一个html响应
json.parse('
const path = require('path');

const package = require('./package.json');

const PATHS = {
    src: path.join(__dirname, './src'),
    public: path.join(__dirname, './public')
};

var config = {
    entry: { 
        app: [ 'babel-polyfill', path.resolve(PATHS.src, 'index.js') ] 
    },
    output: {
        path: path.resolve(PATHS.public),
        filename: 'bundle.js',
        publicPath: '/'
    },
    devServer: {
        contentBase: path.resolve(PATHS.public),
        port: 3000,
        historyApiFallback: true
    },
    module: {
        rules: [
        {
            test: /\.json$/,
            use: [
                { 
                    loader: 'json-loader'
                }
                ]
        },
        {
            test: /\.js$/,
            exclude: /(node_modules|bower_components)/,
            use: [
                { 
                    loader: 'babel-loader'
                }
                ]
        },
        {
            test: /\.css$/,
            use: [
                {
                    loader: "style-loader",
                    options: { singleton: true }
                },
                {
                    loader: "css-loader",
                    options: { 
                        modules: true,
                        camelCase: 'dashes',
                        localIdentName: '[path][name]__[local]' 
                    }
                }
            ]
        }
        ]
    }
};
module.exports = config;
"proxy": "http://localhost:5000/"
proxy: {
   '/api/**': {
   target: 'http://localhost:5000',
   changeOrigin: true
}