Problem on `meteor build....` and running (Custom deployment)


#1

I try to build on Mac

meteor build /Desktop --architecture os.osx.x86_64

But get error

Error: EACCES: permission denied, mkdir '/Desktop'
    at Object.fs.mkdirSync (fs.js:885:18)
    at Object.wrapper [as mkdir] (/tools/fs/files.js:1564:35)
    at Object.files.mkdir_p (/tools/fs/files.js:428:11)
    at buildCommand (/tools/cli/commands.js:1026:11)
    at Command.func (/tools/cli/commands.js:881:12)
    at /tools/cli/main.js:1523:15

Meteor - Custom Deployment
Custom deployment problem: Cannot find module '/opt/tutor/bundle/programs/server/main.js'
#2

Standard users don’t have permission to make folders in the filesystem root. You should try to build to another folder.

Did you mean to use a relative path?
eg:

meteor build ./Desktop --architecture os.osx.x86_64

#3

Thanks for your reply, now it work fine

meteor build ~/Desktop --architecture os.osx.x86_64

but have problem with node run

MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js

Get error

➜  bundle MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js
Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run

  meteor npm install --save bcrypt

in the root directory of your application.

#4

That’s just a warning. It will run just fine.

Though you probably will want to use the native bcrypt module.
Did you run npm install in the /bundle/programs/server/ directory of the built app?


#5

It mean that it is optional for cd programs/server && npm install.
what difference for cd programs/server && npm install -> Global or with ... --save -> Local?


#6

I try run app by don’t use cd programs/server && npm install

// bundle
MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js

Get

module.js:549
    throw err;
    ^

Error: Cannot find module 'fibers'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/theara/Desktop/bundle/programs/server/boot.js:1:75)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

#7

don’t show anything when running

➜  bundle MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js

#8

Running cd programs/server && npm install is not optional. As you discovered, it’s required to make sure the native addon for fibers have been built for the deployed architecture and nodejs version.

What I was saying is that having the native version of bcrypt is optional, as the warning in the console says

In your dev environment, do you have bcrypt in your package.json?
It looks like you need to install the native version in your source before building.


Putting it all together, in your source, run:

meteor npm install --save bcrypt

Then build:

meteor build ~/Desktop --architecture os.osx.x86_64

Then after extracting:

cd programs/server && npm install

now run:

MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js

#9

Thanks again,
But still don’t work, when type on browser address : localhost:3000

MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js

Don’t show anything for along time

Check db name is OK
image


#10

Now it work fine wtih PORT=300

MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost PORT=3000 node main.js

#11

Weird, I can run local builds on port 3000 just fine.

Either way, I’m glad you got there in the end! :slight_smile:


#12

Thanks for your helping :blush:


#13

@coagmano, Excuse me I have any problem:

I tried to use Custom Deployment on DigitalOcean.

How to keep Meteor Running after closed shell/terminal???
(Manage start/stop service in background?


#14

There’s a few common strategies for this.
The one I personally use is monitoring and startup with pm2 http://pm2.keymetrics.io/

The key being to use their startup-hook generation that will detect your platform and register itself as a service.
https://pm2.io/doc/en/runtime/guide/startup-hook/?utm_source=github


#15

Thank for your reply, PM2 is good.