如何解决在Digital Ocean环境中的快速车把中找不到部分零件
部署到Digital Ocean时出现手把部分找不到错误,npm run assemble production
命令失败并且未呈现图标。
我尝试过:
-
changing the partial with the name of a environment variable or HTML tag,将文件名从“ header”更改为“ header-somethingelse”,但错误仍然存在。
-
将hbs.registerPartials添加到config.js文件。还是一样的错误。
> node ./bin/tasks/assemble "production"
events.js:160
throw er; // Unhandled 'error' event
^
Error: The partial global/header could not be found
at Object.invokePartial (/one-table/node_modules/handlebars/dist/cjs/handlebars/runtime.js:332:11)
at Object.handlebars.VM.invokePartial (/one-table/node_modules/engine-handlebars/index.js:196:26)
at Object.invokePartialWrapper [as invokePartial] (/one-table/node_modules/handlebars/dist/cjs/handlebars/runtime.js:84:39)
at Object.eval (eval at createFunctionContext (/one-table/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:262:23),<anonymous>:10:31)
config.js
var express = require('express');
var bodyParser = require('body-parser');
const methodOverride = require('method-override');
var errorHandler = require('errorhandler');
var path = require('path');
var exphbs = require('express-handlebars');
const helpers = require( 'handlebars-helpers')();
module.exports = function() {
var app = express();
app.engine('.hbs',exphbs({
extname: '.hbs',helpers: require(path.join(__dirname,'src','templates','helpers','render')),layoutsDir: path.join(__dirname,'layouts'),partialsDir: path.join(__dirname,'partials'),defaultLayout: 'default'
}));
app.set('port',8080);
app.set('views',path.join(__dirname,'pages'));
app.set('view engine','hbs');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(methodOverride());
app.use(errorHandler());
app.use(express.static(path.join(__dirname,'./build')));
return app;
}();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。