verekia / js-stack-from-scratch

🛠️⚡ Step-by-step tutorial to build a modern JavaScript stack.
MIT License
20.09k stars 1.99k forks source link

last step in section 3 fails on Windows (following instruction on github web page) #238

Closed markandersonus closed 7 years ago

markandersonus commented 7 years ago

After i changed my scripts to:

"scripts": { "start": "yarn dev:start", "dev:start": "nodemon --ignore lib --exec babel-node src/server", "prod:build": "rimraf lib && babel src -d lib --ignore .test.js", "prod:start": "cross-env NODE_ENV=production pm2 start lib/server && pm2 logs", "prod:stop": "pm2 delete server", "test": "eslint src && flow && jest --coverage", "precommit": "yarn test", "prepush": "yarn test" },

this happened

C:\javascript_stack_from_scratch\test>yarn prod:build yarn prod:build v0.27.5 $ rimraf lib && babel src -d lib --ignore .test.js src\server\index.js -> lib\server\index.js src\server\render-app.js -> lib\server\render-app.js src\shared\config.js -> lib\shared\config.js src\shared\util.js -> lib\shared\util.js Done in 1.29s.

C:\javascript_stack_from_scratch\test>yarn prod:start yarn prod:start v0.27.5 $ cross-env NODE_ENV=production pm2 start lib/server && pm2 logs 'pm2' is not recognized as an internal or external command, operable program or batch file. events.js:182 throw er; // Unhandled 'error' event ^

Error: spawn pm2 ENOENT at notFoundError (C:\javascript_stack_from_scratch\test\node_modules\cross-spawn\lib\enoent.js:11:11) at verifyENOENT (C:\javascript_stack_from_scratch\test\node_modules\cross-spawn\lib\enoent.js:46:16) at ChildProcess.cp.emit (C:\javascript_stack_from_scratch\test\node_modules\cross-spawn\lib\enoent.js:33:19) at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12) error Command failed with exit code 1.

markandersonus commented 7 years ago

fixed it by changing

"prod:start": "cross-env NODE_ENV=production pm2 start lib/server && pm2 logs",

to

"prod:start": "cross-env NODE_ENV=production && pm2 start lib/server && pm2 logs",

and then running: "yarn add --dev pm2" (maybe I missed that step)