2016-07-24 6 views
2

の名前空間「OL」は既に宣言されているエラー私は開い層を始める方にhereからの命令を使用していますが、私はエラーを得た:Namespace "ol" already declared - source ol-debug.jsとエラー
this.Va is not a function - source ol.js
オープンレイヤ3 - 起動時

私はかなり私はol.js、ol - debug.jsとol.cssファイルを適切に私のindex.htmlに含まれていることを確かめてください。

Linkレイヤーjsとcssファイルを開きます。あなたはそれらの両方、またはol.jsol-debug.jsのいずれかを宣言する必要がありません

/** 
* Defines a namespace in Closure. 
* 
* A namespace may only be defined once in a codebase. It may be defined using 
* goog.provide() or goog.module(). 
* 
* The presence of one or more goog.provide() calls in a file indicates 
* that the file defines the given objects/namespaces. 
* Provided symbols must not be null or undefined. 
* 
* In addition, goog.provide() creates the object stubs for a namespace 
* (for example, goog.provide("goog.foo.bar") will create the object 
* goog.foo.bar if it does not already exist). 
* 
* Build tools also scan for provide/require/module statements 
* to discern dependencies, build dependency files (see deps.js), etc. 
* 
* @see goog.require 
* @see goog.module 
* @param {string} name Namespace provided by this file in the form 
*  "goog.package.part". 
*/ 
goog.provide = function(name) { 
    if (goog.isInModuleLoader_()) { 
    throw Error('goog.provide can not be used within a goog.module.'); 
    } 
    if (!COMPILED) { 
    // Ensure that the same namespace isn't provided twice. 
    // A goog.module/goog.provide maps a goog.require to a specific file 
    if (goog.isProvided_(name)) { 
     throw Error('Namespace "' + name + '" already declared.'); 
    } 
    } 

    goog.constructNamespace_(name); 
}; 
+1

'私はol.js、ol-debug.jsとol.css'を含んでいると確信しています。両方ともol.jsかol-debug.jsを含めてください。 – pavlos

+0

まあ、それはうんざ!ありがとう。 – vjjj

+0

haha​​。つかまえ...お元気に助けてくれるよ – pavlos

答えて

2

-

これはol-debug.jsファイルから関連する部分です。このエラーは、両方を宣言し、名前空間の競合を引き起こしているという事実から来ています。

関連する問題