问题
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,
回答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.
来源:https://stackoverflow.com/questions/32319150/what-do-i-need-to-know-to-transfer-a-working-node-project