转移有效的Node项目时我需要知道些什么? [英] What do I need to know to transfer a working Node project?

查看:94
本文介绍了转移有效的Node项目时我需要知道些什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将带有正在进行中的网站的Node服务器复制到我自己的笔记本电脑上,以运行它并在那里进行改进,并在它们工作正常时上传更改.

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.

当我将其解压缩并将其传输到Mac时,页面已加载,但未显示特定于Node的功能. Chrome控制台状态:

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

在StackOverflow和网络上进行搜索时,发现有很多人遇到了此错误,而没有很多人意识到可能是次要损坏的错误消息.

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.

此刻,我感到困惑,因为我从服务器转移到笔记本电脑,但无法正常工作.与字节相同的tgz文件大小.

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.

我想知道是否需要从笔记本电脑上进行npm安装,以防万一我从服务器上可用的东西(而不是笔记本电脑)上感到悲伤.现在,Node.js似乎已启动,但是在尝试加载页面时会严重崩溃:

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)

因此,也许是出于迷信,我将node_modules中的所有内容都移到了层次结构之外的临时目录中,并进行了完整的npm安装.

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

我遇到相同的错误,TypeError: Cannot read property 'status' of undefined.

我不确定是否要问XY问题(或者相反),但是我想问:

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

我想让我的webapp从开发和生产两个地方运行.

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?

谢谢

推荐答案

将来要克服诸如开发和生产环境不断变化之类的问题,值得花一些时间来检查Docker.

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.

这篇关于转移有效的Node项目时我需要知道些什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆