Giter Site home page Giter Site logo

Comments (24)

 avatar commented on July 18, 2024

I havnt tried but you can try and set env variable NODE_OPTIONS=--debug . just check meteor documentation to for more info on setting environmental variables

from iron-node.

s-a avatar s-a commented on July 18, 2024

Never thought about that, but it would be nice if this could work. Anyway some help at this point would be nice 😃.

from iron-node.

 avatar commented on July 18, 2024

That is how you would normally debug meteor apps if you was going to use something like node-inspector.

from iron-node.

s-a avatar s-a commented on July 18, 2024

Any success stories on this topic? I find that very interesting. Possibly I invest some time next week to learn more about it.

from iron-node.

phoenixbox avatar phoenixbox commented on July 18, 2024

By not using meteor :trollface:

from iron-node.

fabiodr avatar fabiodr commented on July 18, 2024

That would be great!! The Meteor community doesn't have a good and lasting debugging alternative

from iron-node.

s-a avatar s-a commented on July 18, 2024

Seems meteor ships their own node binaries but works with node.js code generator. To get this working we need to figure out 2 things:

  • how to start a meteor app with node?
  • how to start a mongo db instance if it was not started by the meteor application boot process?

This is the way I would prefer.

As a workaround I found this repo https://github.com/onmodulus/demeteorizer which looks maintained and promising. But not tested yet as far as I hate every pre processing 🐶

Does anyone know more?

from iron-node.

artem-russkikh avatar artem-russkikh commented on July 18, 2024

I try to setup iron-node with meteor:

In file ~/.meteor/meteor the lase line is

# We used to set $NODE_PATH here to include the node_modules from the dev
# bundle, but now we just get them from the symlink at tools/node_modules. This
# is better because node_modules directories found via the ancestor walk from
# the script take precedence over $NODE_PATH; it used to be that users would
# screw up their meteor installs by have a ~/node_modules

exec "$DEV_BUNDLE/bin/node" "$METEOR" "$@"

Its means that meteor use own node for launch app

I try to ln -s /usr/local/bin/iron-node /long_dev_bundle_path/bin/node, but when i try to run meteor app, electron app throw me the error

Uncaught Exception:
~/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/main.js
Error: `~/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/bin/darwin-x64-v8-4.3/fibers.node` is missing. Try reinstalling `node-fibers`?

from iron-node.

s-a avatar s-a commented on July 18, 2024

@artem-russkikh any chance to run npm install within there? Alternative this could work if you install dependecies global?

from iron-node.

s-a avatar s-a commented on July 18, 2024

I' ve tried this:

$ meteor create m;
m: created.

To run your new app:
  cd m
  meteor

$ cd m;

$ meteor;
[[[[[ c:\git\m ]]]]]

=> Started proxy.
=> Started MongoDB.
=> Started your app.

=> App running at: http://localhost:3000/
   Type Control-C twice to stop.

# OK! This works :O)

$ node .meteor\local\build\main.js;
module.js:338
    throw err;
          ^
Error: Cannot find module 'fibers'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (c:\git\m\.meteor\local\build\programs\server\boot.js:1:75)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

$ node .meteor\local\build\main.js;

# OK! This does not work :O(

$ cd .meteor\local\build\;

$ npm install fibers;
$ npm install semver;
$ npm install source-map-support;
$ npm install underscore;

$ node main.js
$ c:\git\m\.meteor\local\build\node_modules\fibers\future.js:267
                                                throw(ex);
                                                      ^
Error: Must pass options.rootUrl or set ROOT_URL in the server environment
    at Object.Meteor.absoluteUrl (packages/meteor/url_common.js:21:1)
    at Object.WebAppInternals.generateBoilerplate (packages/webapp/webapp_server.js:543:1)
    at Object.main (packages/webapp/webapp_server.js:739:1)
    at c:\git\m\.meteor\local\build\programs\server\boot.js:255:27

$ set ROOT_URL=localhost:3000;

$ set ROOT_URL;
ROOT_URL=localhost:3000

$ node main.js
c:\git\m\.meteor\local\build\programs\server\boot.js:263
}).run();
   ^
TypeError: Cannot read property 'slice' of null
    at packages/meteor/url_server.js:11:1
    at c:\git\m\.meteor\local\build\programs\server\packages\meteor.js:1098:4
    at c:\git\m\.meteor\local\build\programs\server\packages\meteor.js:1240:3
    at c:\git\m\.meteor\local\build\programs\server\boot.js:222:10
    at Function._.each._.forEach (c:\git\m\.meteor\local\build\node_modules\underscore\underscore.js:153:9)
    at c:\git\m\.meteor\local\build\programs\server\boot.js:117:5

from iron-node.

s-a avatar s-a commented on July 18, 2024

Just pushed this question to http://stackoverflow.com/questions/31544939/possible-to-start-a-meteor-app-with-node-instead-of-meteor

from iron-node.

s-a avatar s-a commented on July 18, 2024

seems like it needs more configs 😑

from iron-node.

s-a avatar s-a commented on July 18, 2024

Anyway I ended up in the same error as @artem-russkikh. Starting the meteor app with node instead of meteor should be possible. I think the point is that fibers need to be recompiled against current electron version.

I found 2 ways

from iron-node.

artem-russkikh avatar artem-russkikh commented on July 18, 2024

@s-a

He says that ~/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/bin/darwin-x64-v8-4.3/fibers.node is missing

I open ~/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/bin directory - there is only darwin-x64-v8-3.14 folder with fibers.node file

So he is seeking for v8-4.3, but meteor has v8-3.14

from iron-node.

artem-russkikh avatar artem-russkikh commented on July 18, 2024

I also try to put iron-node to meteor dev_bundle

I move original node file mv /long_dev_bundle_path/bin/node /long_dev_bundle_path/bin/nodemeteor

Then manualy copy iron-node and iron-node npm dependencies (electron-prebuilt, markdown, open) to dev_bundle - to folder node_modules
cp /usr/local/bin/iron-node /long_dev_bundle_path/bin/node

Then I change in iron-node file first line from
#!/usr/bin/env node
to
#!/usr/bin/env /long_dev_bundle_path/bin/nodemeteor

So meteor now should open iron-node and iron-node should execute meteor node.
But it throws the same error with fibers :(

from iron-node.

s-a avatar s-a commented on July 18, 2024

Frustrating. Seems we are back in to DLL Hell.
I tried this but facing a weird permission error on windows.
I am using the todos demo and created a debug build to a folder.

  • cd c:\git\todos-build\bundle\server\node_modules\fibers\
  • node-gyp configure c:/git/m\egyp node-gyp rebuild --target=0.30.0 --arch=x32 --dist-url=https://atom.io/download/atom-shell

@artem-russkikh could you try this on your machine to build against latest electron `?

As described at https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md#the-node-gyp-way.

from iron-node.

artem-russkikh avatar artem-russkikh commented on July 18, 2024

@s-a I make new app with meteor create test, then do build meteor build .bundle

I try to use electron-rebuild - its works - electron rebuilds, but problem with fibers is here.

fibers.js added console log for versions

// Look for binary for this platform
var v8 = 'v8-'+ /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0];
console.log(process.versions);
var modPath = path.join(__dirname, 'bin', process.platform+ '-'+ process.arch+ '-'+ v8, 'fibers');
try {
    fs.statSync(modPath+ '.node');
} catch (ex) {
    // No binary!
    throw new Error('`'+ modPath+ '.node` is missing. Try reinstalling `node-fibers`?');
}

so - when i start meteor with node command, in terminal i see:

{ http_parser: '2.3',
  node: '0.12.4',
  v8: '3.28.71.19',
  uv: '1.5.0',
  zlib: '1.2.8',
  modules: '14',
  openssl: '1.0.1m' }

v8 is 3.28, as fibers bin.

when i start server with iron-node in terminal i see the same, but in electron app:

2015-07-23 9 11 27

i try to install iojs but i cant do npm install in programs/server folder:

first:
Error: 404 status code downloading tarball
its resolved by installing node-gyp-install

$ npm install -g node-gyp-install
$ node-gyp-install

now:


\
> [email protected] install /Users/artem_russkikh/tmp/temp/bundle/programs/server/node_modules/fibers
> node ./build.js

(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:132:44: error: too many arguments to function call, expected at most 2, have 4
                return Signature::New(isolate, receiver, argc, argv);
                       ~~~~~~~~~~~~~~                    ^~~~~~~~~~
/Users/artem_russkikh/.node-gyp/2.4.0/deps/v8/include/v8.h:4188:3: note: 'New' declared here
  static Local<Signature> New(
  ^
../src/fibers.cc:140:3: error: no member named 'SetResourceConstraints' in namespace 'v8'; did you mean simply 'SetResourceConstraints'?
                v8::SetResourceConstraints(isolate, constraints);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
                SetResourceConstraints
../src/fibers.cc:139:7: note: 'SetResourceConstraints' declared here
        void SetResourceConstraints(Isolate* isolate, ResourceConstraints* constraints) {
             ^
2 errors generated.
make: *** [Release/obj.target/fibers/src/fibers.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "/usr/local/Cellar/iojs/2.4.0/bin/iojs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/artem_russkikh/tmp/temp/bundle/programs/server/node_modules/fibers
gyp ERR! node -v v2.4.0
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 
Build failed
npm ERR! Darwin 14.4.0
npm ERR! argv "/usr/local/Cellar/iojs/2.4.0/bin/iojs" "/usr/local/bin/npm" "install"
npm ERR! node v2.4.0
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE

this error laverdet/node-fibers#203

from iron-node.

s-a avatar s-a commented on July 18, 2024

Well I had some success when compile binaries from fresh repository clones. Here is the way it works.

# create a meteor build
$ meteor build ../todos-build --debug --directory;

# compile fibers
$ cd c:\git\;
$ git clone https://github.com/laverdet/node-fibers.git;
$ cd node-fibers;
$ set HOME=electron-gyp && node-gyp rebuild --target=0.30.0 --arch=ia32 --dist-url=https://atom.io/download/atom-shell;
# copy output to ..todos-build\bundle\programs\server\node_modules\fibers\bin\win32-ia32-v8-4.3\

# compile bcrypt
$ cd c:\git\;
$ git clone https://github.com/ncb000gt/node.bcrypt.js.git;
$ cd node.bcrypt.js;
$ set HOME=electron-gyp && node-gyp rebuild --target=0.30.0 --arch=ia32 --dist-url=https://atom.io/download/atom-shell;
# copy output to ..todos-build\bundle\programs\server\npm\npm-bcrypt\node_modules\bcrypt\build\bcrypt_lib.node

# start a mongo db
$ cd c:\git\;
$ mkdir mongo;
$ mongod --dbpath c:\git\mongo --port 8001;

# setup metor environment
$ set MONGO_URL=mongodb://localhost:8001/your_db
$ set ROOT_URL=http://localhost:3000

# start
$ cd c:\git\todos-build\bundle\;
$ iron-node main.js;

image

It execs runWebAppServer() in webapp.js, but when I open http://localhost:3000/ in my browser it returns 404.

@artem-russkikh can you help us out here? Maybe we need some more configs?

from iron-node.

s-a avatar s-a commented on July 18, 2024

When i set in webapp.js:766 via console
image

localIp="localhost";
localPort=3000;

I get this in my browser 👍
image

So I missed some configs over there?

from iron-node.

s-a avatar s-a commented on July 18, 2024

Take a look at this https://github.com/s-a/iron-node/blob/master/docs/NATIVE-MODULES.md.

from iron-node.

taromero avatar taromero commented on July 18, 2024

I thought that the reason to use iron-node was to let debugging be simpler (by opening node-inspector when a breakpoint is reached). That's really cool and I would love to use it on Meteor development.

Nevertheless, I think it's simpler to open chrome at the specified URL for debugging manually, than to build the app and compile libraries. That has the additional downside of having to do (rebuild) so whenever you change the code.

Isn't it possible to use iron-node programatically? It would be great to call e.g. IronNode.start inside my code and get this feature of automatically opening the brower when a breakpoint is reached.

from iron-node.

s-a avatar s-a commented on July 18, 2024

ironNode has nothing to do with node-inspector. It works different and it does not depend on it. So this is a special use case.
I agree this is far from optimal, but I think it is a good start point to move more into the prebuild state direction of Meteor apps if possible. IronNode was originally not intended to work with Meteor. It is just the fact I am very interested but unfortunately I am not a Meteor expert.

This is just the progress of an experiment with meteor. We do not need recompile the binaries every time. These can be reused. I realy like to see any mutations of the bash script I wrote. Since Meteor is an own commandline app it is not a trivial topic.

The next step should be to take a closer look to what the meteor commandline app is doing and try to extract this into an own debug.js which could be a startup script we can debug with ironNode.

from iron-node.

s-a avatar s-a commented on July 18, 2024

Just for completeness the whole script so far:

The following is an example to run Meteor apps with ironNode on Windows.

## create a meteor build
$ meteor build ../todos-build --debug --directory

## compile fibers
$ cd c:\git\
$ git clone https://github.com/laverdet/node-fibers.git
$ cd node-fibers
$ set HOME=electron-gyp && node-gyp rebuild --target=0.30.0 --arch=ia32 --dist-url=https://atom.io/download/atom-shell
# copy output to ..todos-build\bundle\programs\server\node_modules\fibers\bin\win32-ia32-v8-4.3\

## compile bcrypt
$ cd c:\git\
$ git clone https://github.com/ncb000gt/node.bcrypt.js.git
$ cd node.bcrypt.js
$ set HOME=electron-gyp && node-gyp rebuild --target=0.30.0 --arch=ia32 --dist-url=https://atom.io/download/atom-shell
# copy output to ..todos-build\bundle\programs\server\npm\npm-bcrypt\node_modules\bcrypt\build\bcrypt_lib.node

## start a mongo db
$ cd c:\git\
$ mkdir mongo
$ mongod --dbpath c:\git\mongo --port 8001

## setup metor environment
$ set MONGO_URL=mongodb://localhost:8001/your_db
$ set ROOT_URL=http://localhost:3000
$ set PORT=3000
$ set BIND_IP=localhost

## start the project
$ cd c:\git\todos-build\bundle\
$ iron-node main.js

from iron-node.

s-a avatar s-a commented on July 18, 2024

Currently it is possible to re compile native modules with an easy command.

cd ..todos-build\bundle\programs\server\
iron-node --compile
# then run the script with --native paramter
cd ..
cd ..
iron-node main.js --native

from iron-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.