bem-archive / bem-tools

Toolkit to work with files based on BEM methodology
http://bem.info/tools/bem/
MIT License
395 stars 72 forks source link

JS Allocation failed in bem make :target/ #252

Closed qfox closed 11 years ago

qfox commented 12 years ago

After executing $ bem make core/level/ ... JS Allocation failed

Seems like there is unlimited recursion somewhere.

arikon commented 12 years ago

Provide more info please. At least full stacktrace.

qfox commented 12 years ago

How I can forse nodejs to write stacktrace?

$ bem --version 0.5.16

Micro example:

$ bem make bem-bl/
00:54:05.442 - info: bem 0.5.16
00:54:05.503 - info: Graph:
== root
 all
   build

FATAL ERROR: JS Allocation failed - process out of memory

But sh $ bem make bem-bl works fine. Error: There is no such id in arch.nodes: bem-bl

arikon commented 12 years ago

Show your .bem/make.js then.

qfox commented 12 years ago

.bem/make.js

var
    LevelNode = require('bem/lib/nodes/level').LevelNode,
    BundlesLevelNode = require('bem/lib/nodes/level').BundlesLevelNode,

    basePaths = ['app/bemyeah']; //, 'module/bemyeah', 'core/bemyeah'],
    qwepages = function () {

    };

//console.log(PATH.resolve, LevelNode, BundlesLevelNode);

MAKE.decl('Arch', {

    getLibraries: function() {

        return {
            'core/bem-bl': {
                type: 'git',
                url: 'git://github.com/bem/bem-bl.git'
            }
        };

    },

    // make custom level nodes
    createBlocksLevelsNodes: function(parent, children) {
        var nodeIds = [], that = this;

        basePaths.forEach(function (v, k) {
            // Create instance of LevelNode
            var node = new LevelNode({
                level: v+'/blocks'
            });
            // Add created node to arch tree
            this.arch.setNode(node, parent, children);
            // Push node id to result list
            nodeIds.push(node.getId());
        }, this);

        // Returns list with ids of created nodes
        return nodeIds;
    },

    // and pages/bundle nodes
    createBundlesLevelsNodes: function(parent, children) {
        var nodeIds = [];

        basePaths.forEach(function (v, k) {
            // Create instance of LevelNode
            var node = new BundlesLevelNode({
                level: v+'/pages'
            });
            // Add created node to arch tree
            this.arch.setNode(node, parent, children);
            // Push node id to result list
            nodeIds.push(node.getId());
        }, this);

        // Возвращаем массив из идентификаторов созданных узлов
        return nodeIds;
    }

});

MAKE.decl('BundleNode', {

    getTechs: function() {

        return [
            'bemjson.js',
            'bemdecl.js',
            'deps.js',
            'bemhtml.js',
            'css',
            'js',
            'html'
        ];
    }

});
qfox commented 12 years ago

But I think it's not depend on it.

$ git clone git://github.com/bem/bem-bl.git bem-bl
$ bem make bem-bl/
02:45:41.355 - info: bem 0.5.16
02:45:41.454 - info: Graph:
== root
 all
   build

FATAL ERROR: JS Allocation failed - process out of memory
qfox commented 12 years ago

rofl:

$ bem make bem-bl//
02:47:23.947 - info: bem 0.5.16
02:47:24.047 - info: Graph:
== root
 all
   build

RangeError: Maximum call stack size exceeded
qfox commented 12 years ago

I think it's minor bug in path analizer.

scf2k commented 12 years ago

It crashes with trailing slash

arikon commented 12 years ago

@zxqfox Don't use trailing slashes as a workaround. We'll fix that.

qfox commented 12 years ago

Sure not. I can't live without trailing slashes! ;-)

scf2k commented 11 years ago

Fix is in master but not in 0.5.x

narqo commented 11 years ago

:+1: Could you release new fixed version, plz, I spent half a day trying to figure out where the bug is :(

scf2k commented 11 years ago

on the go :)