Typing "npm run deploy" gives missing script error. Deploy script is not in the tools folder. Is there an example on how to deploy the built bundle to Github pages? Thanks :)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Run npm install git-push --save-dev;
Create tools/deploy.js file with approximately the following content:
import push from 'git-push';
const remote = {
name: 'production',
url: 'http://github.com/user/test.example.com',
branch: 'gh-pages'
};
export default async () => {
await build();
await new Promise(resolve => push('./build', remote, resolve));
});
Add this script to package.json/scripts. Then you can deploy your app with a single command:
$ npm run deploy
Thanks @koistya ! I'll give that a try
Hi,
I tried this code in combination with your azure branch, but it doesn't seem to work. Azure Apps has a problem finding some modules:
Thu Aug 20 2015 09:34:06 GMT+0000 (Coordinated Universal Time): Unaught exception: Error: Cannot >find module 'source-map-support'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.(D:\home\site\wwwroot\server.js:1:63)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
A year ago I tried to deploy a webapp using the MEAN stack to Azure Apps and I ran into a lot of problems... I hope there's just something missing here ; )
The script mentioned above works with a little change for git repositories in general.
import push from 'git-push';
const remote = {
name: 'production',
url: 'http://github.com/user/test.example.com',
branch: 'gh-pages'
};
export default async () => {
// await build();
await require('./build')();
await new Promise(resolve => push('./build', remote, resolve));
});
@janhase it's seems like you can deploy to Azure as it is, without bringing the .deployment and deploy.cmd scripts from the azure branch (since azure creates these files for you if they don't exist). I'm wondering why it complains about the source-map-support module because in Azure it should run npm install --production command, which skips devDependencies (as it should be).
@koistya I got it up and running on Azure and Heroku. I changed the scripts section of the package.json to:
"scripts": {
...
"start-dev": "babel-node --eval \"require('./tools/start')().catch(err => console.log(err.stack))\"",
"start": "NODE_ENV=production node server.js"
}
Azure, Heroku & Co run "npm start", so there should be no dev stuff in there. Or at least a switch between production and dev.
EDIT: A better way could be to exchange
"start-dev": "babel-node --eval \"require('./tools/start')().catch(err => console.log(err.stack))\""
with
"start": "NODE_ENV=production node server.js"
in copy.js
I know this is a very old thread but I'm running up against the same error when attempting to deploy the react-starter-kit to Azure.
Error: Cannot find module 'source-map-support'
I think @janhase's solution is out-of-date now. Has anyone ran into this error? How did you fix it?
Thanks in advanced!
Most helpful comment
I know this is a very old thread but I'm running up against the same error when attempting to deploy the react-starter-kit to Azure.
Error: Cannot find module 'source-map-support'I think @janhase's solution is out-of-date now. Has anyone ran into this error? How did you fix it?
Thanks in advanced!