我使用下面的代码在我包含的所有模板中得到了这个错误:
{% include '../public/templates/header.html' %}
有没有人知道可能出了什么问题?
Error: UNKNOWN, unknown error '//../public/templates/header.html'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at getSingle (C:\project\node_modules\swig\lib\sw
具体来说,我想调用{% if typeof(myvar) == "boolean" %}或{% set a = parseInt(myvar) %},但是现在它给出了这个错误:
(/home/aidan/Desktop/nodejs/turbo/node_modules/swig/lib/swig.js:465:11) (/home/aidan/Desktop/nodejs/turbo/node_modules/swig/lib/swig.js:560:16) at Function.exports.swig.render (/home/aidan/Desktop/nodej
有没有办法调试node.js的swig模板引擎,因为在某些情况下,我不能得到发生错误的确切文件,例如
{% set temp = JSON.parse('some random string') %}
这就是我在控制台中得到的上面的结果:
2015-08-13T09:38:12.254Z - error: SyntaxError: Unexpected token s
at Object.parse (native)
at Object.eval [as tpl] (eval at <anonymous> (/home/saurabh/intl/via_node/n
我正在尝试设置使用Swig的节点合并(express v3.1.0)。我一直在犯错误
错误:无法在Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:362:17)处/home/jamie/node_ at Function.exports.swig.render (module.js:378:17)处找到模块'swig‘/home/jamie/node_modules/consolida
我已经将swig作为模板引擎添加到我的KeystoneJS项目中,但是它不会加载我的模板。我已将以下内容添加到我的keystone.js文件中:
// Require keystone
var keystone = require('keystone');
var swig = require('swig');
// Initialise Keystone with your project's configuration.
// See http://keystonejs.com/guide/config for available options
我试图访问我的路由/api和/api/超级英雄,但是当我这样做时,我会得到这个错误。
Not Found
404
NotFoundError: Not Found
at C:\Users\mikae\Desktop\Project\node-express-swig-mongo\app.js:27:8
at Layer.handle [as handle_request] (C:\Users\mikae\Desktop\Project\node-express-swig-mongo\node_modules\express\lib\router\layer.js:95:5)
我正试着和一起学习。我正在从头开始编写代码,因为我尝试了一个普通的框架,但是它生成了大量的文件,而且它对我来说是太多了。
目前,我的Swig模板index.html不呈现HTML。这是我得到的输出:
{% include 'header.html' %}
<br>Welcome to my test website
如我所料
This is coming from Header
<br>Welcome to my test website
为什么它不呈现?
以下是我的文件夹结构:
--config
-config.js
--node_modules
当我在nodemon上更新我的服务器时,我得到了这个错误。 C:\Users\mikae\Desktop\Project\node-express-swig-mongo\node_modules\mongoose\lib\index.js:523
throw new mongoose.Error.MissingSchemaError(name);
^
MissingSchemaError: Schema hasn't been registered for model "superheros".
Use mongoose.model(name
我正在用swig构建一个javascript的c++包装器。创建example.i文件编译并创建example_wrap.cxx文件,然后在用node编译时会出现生成错误。
错误:
make: Entering directory '/home/snehabhapkar/Videos/swig/example1/build'
make: *** No rule to make target 'Release/obj.target/example/example.o', needed by 'Release/obj.target/example.node&
我安装了Sails.js 0.9.4并使用以下命令创建了一个使用swig模板引擎的应用程序:
sails new sailsproject--template=swig
当我试图通过sails lift运行该应用程序时,我会得到以下错误:
C:\Users\akis\Desktop\sailsproject>sails lift
C:\Users\akis\AppData\Roaming\npm\node_modules\sails\node_modules\express\lib\ap
plication.js:174
if ('function' != type
有没有人有幸使用CMake通过SWIG创建Ruby绑定?我在CMake文件中有一个通过SWIG创建Python绑定的工作示例,但是当我使用相同的方法创建Ruby绑定时,实际的Ruby文件不会被创建。使用有效的Python绑定,可以创建Python文件。
下面是我的CMakeLists.txt文件的相关部分:
if (${SWIG_FOUND})
find_package( Ruby REQUIRED )
include_directories(
${RUBY_INCLUDE_DIRS}
)
include (${SWIG_USE_FILE})
set (C