项目在两台计算机上共享时出现Webpack错误

时间:2017-05-19 20:20:32

标签: javascript node.js reactjs webpack webpack-dev-server

我的项目已保存在Google云端硬盘文件夹中。它在我的一台机器上工作正常,但另一方面,当它试图编译我的代码时,我遇到了一堆错误。他们发现所有相同的错误,并且似乎与加载图片有关 - 以下是一个示例(其他都是相同的,仅适用于不同的图片)

    ERROR in ./app/images/profilePics/blankface.jpg
Module build failed: Error: spawn EACCES
    at exports._errnoException (util.js:1050:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:378:9)
    at module.exports (/Users/Chris/Google Drive/AcademyReact/node_modules/execa/index.js:130:26)
    at fsP.writeFile.then (/Users/Chris/Google Drive/AcademyReact/node_modules/exec-buffer/index.js:35:15)
 @ ./app/admin/components/SideMenu.js 53:12-61

它似乎只适用于图像加载器 - 我没有得到任何其他错误。

这是我的配置文件:

var webpack = require('webpack');
var path = require('path');
var nodeModulesPath = path.resolve(__dirname, 'node_modules');
var buildPath = path.resolve(__dirname, 'public');
var mainPath = path.resolve(__dirname, 'app', 'main.js');

var config = {

    devtool: 'source-map',
    devServer: {
      historyApiFallback: true
    },
    entry: [

        'webpack/hot/dev-server',
        'webpack-hot-middleware/client',
        'whatwg-fetch',
        //Our application
        mainPath
    ],
    output: {
        path: '/',
        publicPath: 'http://localhost:3000/',
        //assetsPublicPath: 'http://localhost:3000/',
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                test: /\.js?$/,
                loader: 'babel',
                exclude: nodeModulesPath
            },
            {
                test: /\.css$/,
                loader: 'style!css?sourceMap&modules!postcss?sourceMap'
            },
            {
                test: /\.(jpe?g|png|gif|svg)$/i,
                loaders: [
                  'file?hash=sha512&digest=hex&name=[hash].[ext]',
                  'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
                ]
            },
            {
                test: /\.html$/,
                loader: 'html-loader?attrs[]=video:src'
            }, 
            {
                test: /\.mp4$/,
                loader: 'url?limit=10000&mimetype=video/mp4'
            }

        ]
    },
    postcss: [
        require('autoprefixer'),
        require('precss')
    ],
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ]
};

module.exports = config;

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

模块构建失败:错误:生成EACCES,这是权限问题。