如何通过 Node 运行构建的 Meteor 示例应用程序 [英] How to run built of Meteor's sample app via Node
本文介绍了如何通过 Node 运行构建的 Meteor 示例应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 Node.js 运行最基本的 Meteor 应用程序.我有条不紊地进行以下操作;
- mkdir src &&cd src
- meteor 创建 sample_app
- npm install --production
- 流星构建... --allow-superuser --directory
- cd …/bundle
- 节点 --version<块引用>
v4.6.1
- 节点 main.js
但是,它抛出以下错误;
module.js:327抛出错误;^*错误:找不到模块纤维"在 Function.Module._resolveFilename (module.js:325:15)在 Function.Module._load (module.js:276:25)在 Module.require (module.js:353:17)在要求(内部/module.js:12:17)在对象.
(/server/boot.js:1:75)
在 Module._compile (module.js:409:26)在 Object.Module._extensions…js (module.js:416:10)在 Module.load (module.js:343:32)在 Function.Module._load (module.js:300:12)在 Module.require (module.js:353:17)*
为什么我不能通过这些简单的步骤运行最基本的 Node 应用程序?谢谢!
解决方案
我假设您已经安装了 node js、pm2、mongodb 并且您已经创建了一个 DBNAME、带有 USERNAME 和 PASSWORD 的用户.
在你创建了一个流星项目之后.
- 使用命令
meteor build --server-only 进行构建.
- 会为您创建一个 tar 文件
xyz.tar.gz
.使用命令tar -xzf xyz.tar.gz
解压它. - 在文件夹内转到
bundle/programs/server/
然后运行命令npm install --production
- 安装 pm2 节点包.
- 将 mongo db 属性设置为
export MONGO_URL="mongodb://username:password@127.0.0.1:27017/dbName";export ROOT_URL="http://localhost/";export PORT=3000代码>
- 回到
bundle/
目录并使用命令pm2 start --name UID" main.js
运行pm2. - 查看项目是否在线并运行使用命令
pm2 show 0
I want to run the most basic Meteor app via Node. I make the following, orderly;
- mkdir src && cd src
- meteor create sample_app
- npm install --production
- meteor build … --allow-superuser --directory
- cd …/bundle
- node --version
v4.6.1
- node main.js
But, it throws the following error;
module.js:327
throw err;
^
*Error: Cannot find module 'fibers’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.
(/server/boot.js:1:75)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)*
Why cannot I run the most basic Node app via those simple steps? Thank you!
解决方案
I assume you have installed node js, pm2, mongodb and you have create a DBNAME, USER with USERNAME and PASSWORD.
After you create a meteor project.
- BUILD using command
meteor build --server-only .
- A tar file
xyz.tar.gz
will be created for you. Use commandtar -xzf xyz.tar.gz
to untar it. - Inside the folder goto
bundle/programs/server/
and then run commandnpm install --production
- Install pm2 node package.
- set mongo db properties as
export MONGO_URL="mongodb://username:password@127.0.0.1:27017/dbName";export ROOT_URL="http://localhost/";export PORT=3000
- Go back to
bundle/
directory and run pm2 using commandpm2 start --name "UID" main.js
. - To view if project is online and running use command
pm2 show 0
这篇关于如何通过 Node 运行构建的 Meteor 示例应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文