1
copy-webpack-plugin私のapp/imagesディレクトリのファイルをpublic/img
のnpm run development
にコピーしようとしています。しかし、何らかの理由で次のエラーが発生しています。"webpack-dev-server"を実行するとCopyWebpackPluginが失敗する
npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "webpack-dev-server"
npm ERR! node v5.8.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] webpack-dev-server: `NODE_ENV=development PORT=8080 webpack-dev-server --content-base public/ --hot --inline --devtool inline-source-map --history-api-fallback`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] webpack-dev-server script 'NODE_ENV=development PORT=8080 webpack-dev-server --content-base public/ --hot --inline --devtool inline-source-map --history-api-fallback'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the global-gamesey package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=development PORT=8080 webpack-dev-server --content-base public/ --hot --inline --devtool inline-source-map --history-api-fallback
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs global-gamesey
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls global-gamesey
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/travis.tb/git/global-gamesey/npm-debug.log
npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "development"
npm ERR! node v5.8.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] development: `cp views/index.html public/index.html && NODE_ENV=development webpack && npm run webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] development script 'cp views/index.html public/index.html && NODE_ENV=development webpack && npm run webpack-dev-server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the global-gamesey package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cp views/index.html public/index.html && NODE_ENV=development webpack && npm run webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs global-gamesey
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls global-gamesey
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/travis.tb/git/global-gamesey/npm-debug.log
なぜスクリプトが失敗しますか?私のwebpack.configファイルには、次の行が含まれています:
// webpack.config.js
var webpack = require('webpack')
//copy files
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
if(process.env.NODE_ENV === 'development'){
var loaders = ['react-hot','babel']
} else {
var loaders = ['babel']
}
module.exports = {
devtool: 'eval',
entry: './app-client.js',
output: {
path: __dirname + '/public/dist',
filename: 'bundle.js',
publicPath: '/dist/'
},
module: {
loaders: [{
test: /\.js$/,
loaders: loaders,
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}
]},
plugins: [
new webpack.DefinePlugin({
'process.env.COSMIC_BUCKET': JSON.stringify(process.env.COSMIC_BUCKET)
}),
new CopyWebpackPlugin([
{ from: '/images/', to: '/public/img/' }
])
]
};
私が間違っていることはありますか?私はGulpの観点から来ているので、webpackがこの単純な作業を本当に奇妙に扱う方法を見いだしています。