jedireza / aqua

:bulb: A website and user system starter
https://jedireza.github.io/aqua/
MIT License
1.38k stars 357 forks source link

babel-core/register error #155

Closed shebatech closed 7 years ago

shebatech commented 7 years ago

Hi Jed,

I used your previous framework "drywall" to implement my App, and now I though I would do a redesign and noticed that you have published "aqua", so I though why not, I'll redesign the whole App again and use aqua instead.

Dealing with Openshift is kind of a pain as there is lots that can go wrong, I have got my App to successfully deploy on Openshift after few tweaks to package.json file, mainly the start script and main parameters which I'll list below.

{ "name": "aqua", "version": "5.0.5", "description": "A website and user system for Node.js", "main": "server.js", "scripts": { "start": "node server.js", "first-time-setup": "node first-time-setup.js", "test": "lab -t 99 -S -T ./test/lab/transform -L --lint-options '{\"extensions\":[\".js\",\".jsx\"]}' ./test/lab/client-before.js ./test/client/ ./test/lab/client-after.js ./test/server/ ./test/lab/server-after.js ./test/misc/", "test-client": "lab -v -t 99 -S -T ./test/lab/transform -L --lint-options '{\"extensions\":[\".js\",\".jsx\"]}' ./test/lab/client-before.js $TEST_TARGET ./test/lab/client-after.js || true", "test-server": "lab -v -t 99 -S -T ./test/lab/transform -L --lint-options '{\"extensions\":[\".js\",\".jsx\"]}' $TEST_TARGET ./test/lab/server-after.js || true", "postinstall": "gulp build" }, "author": "Reza Akhavan jedireza@gmail.com (http://reza.akhavan.me/)", "license": "MIT", "engines": { "node": ">=6.0.0" }, "dependencies": { "async": "2.x.x", "bcryptjs": "~2.0.2", "boom": "4.x.x", "classnames": "2.x.x", "confidence": "3.x.x", "crumb": "6.x.x", "dotenv": "2.x.x", "escape-string-regexp": "1.x.x", "glue": "4.x.x", "handlebars": "4.x.x", "hapi": "15.x.x", "hapi-auth-cookie": "6.x.x", "hapi-mongo-models": "6.x.x", "hapi-react-views": "9.x.x", "hoek": "4.x.x", "inert": "4.x.x", "joi": "9.x.x", "mongo-models": "1.x.x", "mongodb": "2.x.x", "node-uuid": "1.4.7", "nodemailer": "2.x.x", "nodemailer-markdown": "1.x.x", "object-assign": "4.x.x", "react": "15.x.x", "redux": "3.x.x", "slug": "0.9.x", "vision": "4.x.x", "visionary": "6.x.x" }, "devDependencies": { "babel-core": "6.x.x", "babel-loader": "6.x.x", "babel-preset-es2015": "6.x.x", "babel-preset-react": "6.x.x", "bootstrap": "3.x.x", "code": "3.x.x", "cookie": "0.3.x", "del": "2.x.x", "eslint-config-hapi": "10.x.x", "eslint-plugin-react": "6.x.x", "flux": "2.x.x", "flux-constant": "1.x.x", "font-awesome": "4.x.x", "gulp": "3.x.x", "gulp-concat": "2.x.x", "gulp-less": "3.x.x", "gulp-newer": "1.x.x", "gulp-nodemon": "2.x.x", "gulp-rename": "1.x.x", "gulp-sourcemaps": "1.x.x", "gulp-util": "3.x.x", "jsdom": "9.x.x", "lab": "11.x.x", "lodash": "4.x.x", "merge-stream": "1.x.x", "moment": "2.15.x", "nodemon": "1.x.x", "promptly": "2.x.x", "proxyquire": "1.x.x", "qs": "6.x.x", "react-addons-linked-state-mixin": "15.x.x", "react-addons-test-utils": "15.x.x", "react-dom": "15.x.x", "react-router": "2.x.x", "require-dir": "0.3.x", "webpack": "1.x.x", "xhr": "2.x.x" } }

I also tweaked the server environments to meet Openshift's IP and port. After getting the deployment successful message from Openshift, I get a 503 Error "service temporarily unavailable", I used ssh to login into my openshift gear to look up the server log errors and I am getting this one

module.js:472 throw err; ^ Error: Cannot find module 'babel-core/register' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/var/lib/openshift/5875382989f5cf0d60000182/app-root/runtime/repo/index.js:2:23) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3)

I attempted to install babel-register, but that didnt work. Another thing that I changed in package.json is bycrpt to bycrptjs, it was throwing some errors about bycrpt which I dont think has anything to do with babel-core/register error.

*note: works like a charm locally on macosx latest version.

Any help to make this work would be greatly appreciated. Meanwhile, I'll keep trying different things.

jedireza commented 7 years ago

Thanks for opening an issue. It sounds like you're missing your dev dependencies. "Running in production" is documented in the readme: https://github.com/jedireza/aqua#running-in-production

shebatech commented 7 years ago

Thank you for your prompt response, I appreciate it.

I have setup the env variables into Openshift and I can confirm they're setup using the following command which returns them

ShebaTechs-MacBook-Air:server shebatech$ rhc env list dev NODE_ENV=production NPM_CONFIG_PRODUCTION=false

I cleared my nodejs.log file in Openshift and run git push to trigger the application rebuild process. Unfortunately, I am still getting the 503 error when I view the page and the logs are still showing that it cannot find the babel-core/register module.

I am wondering and I will try it in a bit if I move all devDependencies from package.json to dependencies to brute force the installation process of these packages required.

jedireza commented 7 years ago

The instructions in the README are for Heroku. You'll have to lookup the solution for Openshift or merge devDependencies into dependencies.

shebatech commented 7 years ago

Merged dependencies and now it stopped complaining about babel-core/register, but it's complaining about something else. Will have to give Heroku a shot, maybe it'll simplify things in the long run.

fs.js:558 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: EACCES: permission denied, open '/var/lib/openshift/5875382989f5cf0d60000182/.babel.json' at Object.fs.openSync (fs.js:558:18) at Object.fs.writeFileSync (fs.js:1223:33) at save (/var/lib/openshift/5875382989f5cf0d60000182/app-root/runtime/repo/node_modules/babel-register/lib/cache.js:45:16) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) at Module.runMain (module.js:607:11) at run (bootstrap_node.js:420:7) at startup (bootstrap_node.js:139:9) at bootstrap_node.js:535:3

Thanks again!

shebatech commented 7 years ago

Just an update, deployment of Aqua on Heroku was super smooth! Now I'll attempt to integrate MaterializeCSS to it instead of bootstrap.