0

I am trying to copy a Node server with a work-in-progress website to my own laptop to run it and work on improving it there, uploading changes when they're working fittingly.

When I tarred it up and transferred it to my Mac, the page loaded, but no Node-specific functionality showed up. The Chrome console states:

Uncaught TypeError: type.toUpperCase is not a function              react-with-addons: 9729

Searches on StackOverflow and on the web reveal a lot of people hitting this error, and not a lot of people making sense of what may be a secondary damage error message.

At the moment I'm puzzled because I transfer from my server to my laptop and it doesn't work. Same tgz file size to the byte.

I wondered if I needed to do an npm install from my laptop, in case I was getting grief from something being available on the server but not my laptop. Now Node.js appears to start, but it crashes hard on attempted page load:

$ bin/www
Server running.

TypeError: Cannot read property 'status' of undefined
    at new ResourceError (/Users/jonathan/server/node_modules/express-stormpath/node_modules/stormpath/lib/error/ResourceError.js:7:29)
    at Request.onRequestResult [as _callback] (/Users/jonathan/server/node_modules/express-stormpath/node_modules/stormpath/lib/ds/RequestExecutor.js:96:23)
    at Request.self.callback (/Users/jonathan/server/node_modules/express-stormpath/node_modules/stormpath/node_modules/request/request.js:123:22)
    at Request.emit (events.js:98:17)
    at Request. (/Users/jonathan/server/node_modules/express-stormpath/node_modules/stormpath/node_modules/request/request.js:1047:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage. (/Users/jonathan/server/node_modules/express-stormpath/node_modules/stormpath/node_modules/request/request.js:998:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

So, perhaps superstitiously, I move everything in node_modules to a temporary directory outside the heirarchy, and do a full npm install.

I get the same error, TypeError: Cannot read property 'status' of undefined.

I'm not sure if I'm asking an XY question (or the opposite?), but I wanted to ask:

I want to have my webapp running from two places, development and production.

I'm having nontrivial difficulties copying from production to development.

How should I be approaching things so that I can make changes to the development copy at will, and deploy to production when that seems appropriate? Do I restart from the tarball from the (production) server? Is there something basic I should read?

Thanks,

Christos Hayward
  • 5,777
  • 17
  • 58
  • 113
  • You don't happen to have files those names differ only in case. Macs used to be and may still be case-insensitive. – Dan D. Aug 31 '15 at 20:11
  • Macs are case-preserving. But I don't think case sensitivity/preservation/insensitivity is an issue here; it's gone from Mac to Linux to Mac. – Christos Hayward Aug 31 '15 at 20:23
  • Are you copy stormpath API key? – stdob-- Aug 31 '15 at 20:52
  • Yes, I have a Stormpath API key. – Christos Hayward Aug 31 '15 at 21:20
  • @DanD., case sensitivity is a behavior of filesystems dealing with filenames. It does not affect e.g. the contents of JavaScript files; if you should have a set of JavaScript filenames that don't collide, Chrome will not know or care about what system it's run on, and case sensitivity will be handled according to the language's rules. Trouble calling type.toUpperCase should not be an issue where filesystem's case handling has any impact. – Christos Hayward Aug 31 '15 at 21:23
  • Time to read the source code. Can you post the exact version of stormpath you have installed in both places and the node version you are using in each machine? – Peter Lyons Aug 31 '15 at 22:45
  • @PeterLyons Stormpath is 0.10.2 on laptop, 0.10.0 on server; Node is v0.10.36 on the laptop and v0.12.7 on the server. Do I need to reinstall either or both to current production version? – Christos Hayward Aug 31 '15 at 23:15
  • Those stormpath numbers don't seem to correspond to actual releases. I'm expecting one of the release numbers shown here: https://github.com/stormpath/stormpath-express/releases – Peter Lyons Sep 01 '15 at 02:06
  • Meaning uninstall Stormpath and reinstall the latest stable release? (Or something else?) Thanks! – Christos Hayward Sep 02 '15 at 02:54
  • Thank you for all your help. I realized the question I had was changing and I cut a separate question at http://stackoverflow.com/questions/32359759/i-want-to-use-stormpath-express-js-and-node-js-do-i-want-stormpath-express-or . Any help with the successor question would be appreciated. Thanks, – Christos Hayward Sep 02 '15 at 17:41
  • Hey Jonathan, I just answered your other SO thread -- if you want help with this, you might want to post up ALL your code here -- it's impossible to debug without looking at everything, (including the package.json). – rdegges Sep 03 '15 at 22:37

1 Answers1

1

In future to overcome problems such as this where the development and production environment are constantly changing it is worth taking some time to check out Docker.

Docker

This enables you to remove concerns from the host machine and instead run instances, containers, containing the application/system.

hudsond7
  • 666
  • 8
  • 25