How to setup a meteor project with existing code

I have a working meteor project with 5 code folders private, public, lib, client, server and the build folder .meteor. I want to deploy this project to another test server. Is it fine to just copy the code folders and the files in .meteor folder (packages, versions, release, platforms files ) ?. I lost the .meteor\local folder as it is not archived. So, I went ahead and tried it.

running meteor in this project folder gives the following error:

W20170313-19:08:47.847(5.5)? (STDERR) app\server\main.js:1
W20170313-19:08:47.850(5.5)? (STDERR) (function(Npm,Assets){(function(){import {
Meteor } from ‘meteor/meteor’;
W20170313-19:08:47.852(5.5)? (STDERR) ^^^^^^
W20170313-19:08:47.854(5.5)? (STDERR)
W20170313-19:08:47.856(5.5)? (STDERR) SyntaxError: Unexpected reserved word
W20170313-19:08:47.858(5.5)? (STDERR) at Object.exports.runInThisContext (vm
.js:53:16)

On stackoverflow, someone suggested to add ecmascript package. After adding, I get a different error.

Is there any guideline on how to setup a meteor project from existing code ?

A working meteor app is a working meteor app. What’s the latest error? It should work if you’re running the same code with the same packages, that are correctly installed.

when I used the working code, i did not install any packages. I just used a copy of the packages and version files expecting meteor to download automatically the correct packages. I never added the ecmascript in my original project. Not sure if I should even add that.
After adding ecmascript, I get the follwoing error.

W20170313-19:39:06.276(5.5)? (STDERR) C:\Users\Satyakvv\AppData\Local.mete
or\packages\meteor-tool\1.4.1_2\mt-os.windows.x86_32\dev_bundle\server-lib\node_
modules\fibers\future.js:280
W20170313-19:39:06.280(5.5)? (STDERR)
throw(ex);
W20170313-19:39:06.281(5.5)? (STDERR)
^
W20170313-19:39:06.283(5.5)? (STDERR)
W20170313-19:39:06.284(5.5)? (STDERR) ReferenceError: getProjFilterIds is not de
fined
W20170313-19:39:06.287(5.5)? (STDERR) at meteorInstall.lib.Tabular.js (lib/T
abular.js:225:13)
W20170313-19:39:06.289(5.5)? (STDERR) at fileEvaluate (packages/modules-runt
ime/.npm/package/node_modules/install/install.js:153:1)
W20170313-19:39:06.291(5.5)? (STDERR) at require (packages/modules-runtime/.
npm/package/node_modules/install/install.js:82:1)
W20170313-19:39:06.293(5.5)? (STDERR) at d:\myapp\Server\dummy.mete
or\local\build\programs\server\app\app.js:5179:1
W20170313-19:39:06.295(5.5)? (STDERR) at d:\myapp\Server\dummy.mete
or\local\build\programs\server\boot.js:292:10
W20170313-19:39:06.297(5.5)? (STDERR) at Array.forEach (native)
W20170313-19:39:06.298(5.5)? (STDERR) at Function..each..forEach (C:\Users
\Satya.EPIANCE\AppData\Local.meteor\packages\meteor-tool\1.4.1_2\mt-os.windows.
x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20170313-19:39:06.300(5.5)? (STDERR) at d:\myapp\Server\dummy.mete
or\local\build\programs\server\boot.js:128:5

getProjFilterIds is a custom function which is defined in the same js file at the top. There is no such error in the working folder.

Pretty sure that if you were using import in your code you were using ecmascript. Not sure I can help you much more without seeing more of your code.

Actually, I am looking for some guideline on how to setup a project from the existing working code from GIT. I have the source code and also the packages text file.

Most apps you can clone, npm install the npm packages and meteor run or bundle the app for production. Having your app setup like this can make it easy to deploy locally or remotely when you need to. I suggest getting setup like this, it will make your future life way easier.

You can start by making sure the npm packages you need are listed in the dependencies block of your app’s package.json file. And then your meteor packages can be version controlled in your app’s .meteor/packages file. Once you have your packages there, you could just clone your app and reinstall the necessary packages each time (which should only take a few seconds if you have a decent internet connection). Here’s the relevant section about entering your dependencies in your package.json. Also, to auto-save your npm deps in package.json you can use the npm install --save [some-package] them.

Hope this helps! If you don’t have your app in a git repo yet you can git init in your app (top level) which will create a repo and then proceed with git there.

1 Like