2016-04-03 4 views
1

Ich versuche, eine Node.JS App zu erstellen, die das Open-Source-Alpaka-Forms-Paket verwendet:Vorlage wurde mit einer neueren Version von Lenkerfehler mit meiner Node.JS-App vorkompiliert?

http://www.alpacajs.org/

Ich bin mit Node-Version: v0.10.25

Als ich das laufen Testseite aus dem Tutorial:

http://www.alpacajs.org/tutorial.html

die zweite Beispielseite in diesem Tutorial gefunden verwenden:

<html> 
    <head> 
     <link type="text/css" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" /> 
     <link type="text/css" href="//code.cloudcms.com/alpaca/1.5.17/bootstrap/alpaca.min.css" rel="stylesheet" /> 
     <script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script> 
     <script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> 
     <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.3/handlebars.js"></script> 
     <script type="text/javascript" src="//code.cloudcms.com/alpaca/1.5.17/bootstrap/alpaca.min.js"></script> 
    </head> 
    <body> 
     <div id="form"></div> 
     <script type="text/javascript"> 
      $(document).ready(function() { 
       $("#form").alpaca({ 
        "schema": { 
         "title":"User Feedback", 
         "description":"What do you think about Alpaca?", 
         "type":"object", 
         "properties": { 
          "name": { 
           "type":"string", 
           "title":"Name" 
          }, 
          "feedback": { 
           "type":"string", 
           "title":"Feedback" 
          }, 
          "ranking": { 
           "type":"string", 
           "title":"Ranking", 
           "enum":['excellent','ok','so so'] 
          } 
         } 
        } 
       }); 
      }); 
     </script> 
    </body> 
</html> 

ich die folgenden zwei Fehler in der Chrome-Debugger-Konsole beschweren, dass die Vorlagen ich mit einem neueren Version Lenker als die aktuelle Laufzeit erstellt wurden verwende, nicht ältere wie die meisten die gemeldeten Probleme auf SO angeben. Hier ist der Fehler-Dump aus dem Chrome-Debugger-Konsole:

Uncaught Error: Template was precompiled with a newer version of Handlebars than the current runtime. 
Please update your runtime to a newer version (>= 4.0.0). 
    Exception @ handlebars.js:2520 
    checkRevision @ handlebars.js:2693 
    template @ handlebars.js:2709 
    hb.template @ handlebars.js:196 
    (anonymous function) @ alpaca.min.js:1 
    (anonymous function) @ alpaca.min.js:1 
    (anonymous function) @ alpaca.min.js:1 

Uncaught TypeError: $(...).alpaca is not a function 
    (anonymous function) @ (index):14 
    j @ jquery-1.11.1.min.js:2 
    k.fireWith @ jquery-1.11.1.min.js:2 
    m.extend.ready @ jquery-1.11.1.min.js:2 
    J @ jquery-1.11.1.min.js:2 

ich mit NPM geprüft und ich bin eine Version von Lenker verwenden, die neuer als 4.0.0:

$ npm ls | grep handlebars 
└─┬ [email protected] 

So scheint es die Fehlermeldung ist falsch?

fand ich diese beiden SO Kommentare:

Template was precompiled with an older version of Handlebars than the current runtime

Uncaught Error: Template was precompiled with an older version of Handlebars

Aber ich bin mit Gulp oder Ember.js nicht so weiß ich nicht, ob die gegebenen Heilmittel für meine Situation anwenden . Hier

ist eine Liste der Pakete habe ich installiert nach NPM:

npm ls 
/home/roschler 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ ├─┬ [email protected] 
│ │ │ └── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ ├─┬ [email protected] 
│ │ │ └── [email protected] 
│ │ ├── [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ └─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
└─┬ [email protected] 
    ├── [email protected] 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    └─┬ [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    └─┬ [email protected] 
     ├── [email protected] 
     ├─┬ [email protected] 
     │ ├─┬ [email protected] 
     │ │ ├─┬ [email protected] 
     │ │ │ ├─┬ [email protected] 
     │ │ │ │ └── [email protected] 
     │ │ │ ├── [email protected] 
     │ │ │ └── [email protected] 
     │ │ └── [email protected] 
     │ ├─┬ [email protected] 
     │ │ └─┬ [email protected] 
     │ │ ├─┬ [email protected] 
     │ │ │ └── [email protected] 
     │ │ ├── [email protected] 
     │ │ └── [email protected] 
     │ └── [email protected] 
     ├── [email protected] 
     └── [email protected] 

Wie kann ich diese Fehler zu beheben?

+0

@Omarjmh Ich benutze v0.10.25 –

+0

@Omarjmh Drop-Down? Die Fehlermeldung besagt, dass ich eine neuere Version des Lenkers brauche, nicht älter. –

+0

@Omarjmh Gerade meine Paketliste hinzugefügt. –

Antwort

4

Im Beispiel HTML muss die über ein Script-Tag eingebundene Handlebars-Bibliothek aktualisiert werden. Wenn es sich auf die Laufzeit bezieht, müssen Sie die JS-Bibliothek aktualisieren, die Sie ausdrücklich einschließen und nicht das NPM-Paket (normalerweise).

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.3/handlebars.js"></script> 

Sollte eigentlich eins mit der Version 4.0.0+ enthalten. Zum Beispiel

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.0/handlebars.js"></script> 
+0

Vielen Dank! Das hat es getan. Es funktioniert jetzt. Übrigens, während der (Wieder-) Installation der Lenker 4.0.5 mit NPM habe ich folgende Warnungen bekommen. Sollte ich mir Sorgen um sie machen? [WARNUNG 1] npm http 304 https://registry.npmjs.org/is-buffer npm WARN-Engine [email protected]: gesucht: {"node": "> = 0.12"} (aktuell: {" node ":" v0.10.25 "," npm ":" 1.3.10 "}) [WARNUNG 2] npm http 304 https://registry.npmjs.org/lazy-cache npm WARN-Engine [email protected] .3: gesucht: {"node": "> = 0.12"} (aktuell: {"node": "v0.10.25", "npm": "1.3.10"}) –

+1

Kein Problem. Und im Allgemeinen verursachen diese Kollisionen keine Probleme in meiner Erfahrung. Sie sollten damit einverstanden sein, sie zu ignorieren (solange alles natürlich gut mit ihnen funktioniert). Wenn Sie ein ungewöhnliches Problem mit dem Lenkerbau haben, dann wäre vielleicht die Recherche ein Ausgangspunkt. Aber ich mache mir nie Sorgen über diese Art von Zusammenstößen - bekomme sie ständig. Ich neige dazu, die Knotenversion> = 0.12 zu verwenden, da es so etwas zu bereinigen scheint. – Shakespeare

Verwandte Themen