2017-08-15 13 views
0

githubページに私のリアクションアプリケーションをデプロイしようとしています。ここでnpm run deploy実行時に "build"フォルダが見つかりません

ENOENT: no such file or directory, stat '/Users/username/my-app/build' 

npm ERR! Darwin 16.3.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy" 
npm ERR! node v6.11.0 
npm ERR! npm v3.10.10 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] deploy: `gh-pages -d build` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] deploy script 'gh-pages -d build'. 
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 reactdemo package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  gh-pages -d build 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs reactdemo 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls reactdemo 
npm ERR! There is likely additional logging output above. 

は私のpackage.jsonスクリプトは、私は推測してい

"scripts": { 
    "compile": "webpack", 
    "test": "echo \"Error: no test specified\" && exit 1", 
    "build": "webpack --config webpack.config.js", 
    "predeploy": "npm run build", 
    "deploy": "gh-pages -d build" 
    }, 

Webpack.config.js

const path = require('path'); 

module.exports = { 
    context: path.join(__dirname, 'src'), 
    entry: [ 
    './main.js', 
    ], 
    output: { 
    path: path.join(__dirname, 'www'), 
    filename: 'bundle.js', 
    }, 
    module: { 
    rules: [ 
     { 
     test: /\.js$/, 
     exclude: /node_modules/, 
     use: [ 
      'babel-loader', 
     ], 
     }, 
    ], 
    }, 
    resolve: { 
    modules: [ 
     path.join(__dirname, 'node_modules'), 
    ], 
    }, 
}; 

です:私はこのエラーを取得する "NPMの実行が展開" を実行するたびにそれは私のビルドスクリプトが書かれている方法と関係があることを示しています。 "npm run build"を実行するとうまく動作します。

編集:追加されましたWebPACKのコンフィグ

+0

webpack.config.jsのコンテンツも共有できますか? –

+0

@Shubham Jain私はwebpackファイルを自分の投稿に追加しました – denpa

+0

あなたのプロジェクトの内部にビルドフォルダを作成し、コマンドが機能するかどうか確認してください。 –

答えて

0

コマンドgh-pages -d buildあなたbuildディレクトリからすべてを展開します。しかし、buildディレクトリをバンドルに使用しない場合は、wwwディレクトリを使用してください。

コマンドをgh-pages -d wwwに変更します。

関連する問題