reactjs - No "build" folder found when running npm run deploy -
i trying deploy react app github pages. every time run "npm run deploy" error:
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! reactdemo@1.0.0 deploy: `gh-pages -d build` npm err! exit status 1 npm err! npm err! failed @ reactdemo@1.0.0 deploy script 'gh-pages -d build'. npm err! make sure have latest version of node.js , npm installed. npm err! if do, problem reactdemo package, npm err! not npm itself. npm err! tell author fails on system: npm err! gh-pages -d build npm err! can information on how open issue project with: npm err! npm bugs reactdemo npm err! or if isn't available, can info via: npm err! npm owner ls reactdemo npm err! there additional logging output above.
here package.json scripts
"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'), ], }, };
i guessing has way build script written. running "npm run build" works fine.
edit: added webpack config
command gh-pages -d build
deploy build
directory. don't use build
directory bundle, use www
directory.
change command gh-pages -d www
.
Comments
Post a Comment