Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yo error encode not defined when generating webapp

I get the following when I run yo webapp from the cmd line after following http://www.youtube.com/watch?feature=player_embedded&v=zBt2g9ekiug to about 3 minutes. Has anyone seen this before?

   C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\node_modules\cheeri
o\node_modules\entities\index.js:36
        return encode[level](data);
               ^
ReferenceError: encode is not defined
    at Object.exports.encode (C:\Users\L\AppData\Roaming\npm\node_modules\genera
tor-webapp\node_modules\cheerio\node_modules\entities\index.js:36:9)
    at exports.encode (C:\Users\L\AppData\Roaming\npm\node_modules\generator-web
app\node_modules\cheerio\lib\utils.js:41:50)
    at formatAttrs (C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp
\node_modules\cheerio\lib\render.js:30:32)
    at renderTag (C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\n
ode_modules\cheerio\lib\render.js:113:18)
    at C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\node_modules
\cheerio\lib\render.js:81:17
    at Array.forEach (native)
    at Function._.each._.forEach (C:\Users\L\AppData\Roaming\npm\node_modules\ge
nerator-webapp\node_modules\cheerio\node_modules\underscore\underscore.js:79:11)

    at module.exports (C:\Users\L\AppData\Roaming\npm\node_modules\generator-web
app\node_modules\cheerio\lib\render.js:77:5)
    at Object.exports.html (C:\Users\L\AppData\Roaming\npm\node_modules\generato
r-webapp\node_modules\cheerio\lib\static.js:40:12)
    at Appgenerator.domUpdate (C:\Users\L\AppData\Roaming\npm\node_modules\gener
ator-webapp\node_modules\yeoman-generator\lib\actions\wiring.js:44:14)
like image 266
LiamRyan Avatar asked Dec 25 '22 13:12

LiamRyan


1 Answers

I had same issue when follow tutorial with latest Yomen version. There is typo error in entities library that You can manually fix to complete tutorial:

Open file with error (in your case C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\node_modules\cheerio\node_modules\entities\index.js ) and change variable name from inverse to encode

var decode = levels.map(function(l){ return l.normal; }),
    decodeStrict = levels.map(function(l){ return l.strict; }),
    inverse = levels.map(function(l){ return l.inverse; });

To

var decode = levels.map(function(l){ return l.normal; }),
    decodeStrict = levels.map(function(l){ return l.strict; }),
    encode = levels.map(function(l){ return l.inverse; });
like image 80
Sergey Kurtenko Avatar answered Apr 26 '23 22:04

Sergey Kurtenko