我刚刚升级到最新版本的stencil-cli,现在我编辑时出现错误,或者只是打开任何模板文件。我通过运行:
从版本1.8升级 npm install -g @bigcommerce/stencil-cli
安装新版本后,我运行stencil start
,一切似乎都正常。
然后,我打开了一个模板文件来编辑vi templates/components/common/header.html
。文件打开后,stencil-cli会立即输出以下错误并关闭:
/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:26
return callback(err);
^
TypeError: callback is not a function
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:26:20
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:91:20
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:998:13)
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:906:16
at ReadFileContext.callback (/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:112:24)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)
每次打开或编辑模板文件时都会发生这种情况。当我编辑sass文件时似乎没有发生。到目前为止,我只在编辑/打开/保存templates/
目录中的内容时才看到它。
我正在运行节点v4.2.1
以防万一。
知道为什么会突然发生这种情况吗?最新版本是否存在某种错误?
更新
按照评论中的建议添加日志语句后,现在是完整输出:
[Error: The following template(s) are/is missing:
function (err, v) {
results[index] = v;
callback(err);
}]
/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:27
return callback(err);
^
TypeError: callback is not a function
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:27:20
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:92:20
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:998:13)
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:906:16
at ReadFileContext.callback (/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:113:24)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)
更新
根据评论添加其他调试后,这是新输出。这样的事情有很长的重复序列:
layout/base function (err, v) {
results[index] = v;
callback(err);
} undefined
layout/empty function (err, v) {
results[index] = v;
callback(err);
} undefined
components/carousel function (err, v) {
results[index] = v;
callback(err);
} undefined
components/account/add-wishlist function (err, v) {
results[index] = v;
callback(err);
} undefined
components/account/address-list function (err, v) {
results[index] = v;
callback(err);
} undefined
components/account/edit-account function (err, v) {
results[index] = v;
callback(err);
} undefined
这将持续几百行,然后以此结束:
pages/account/orders/completed function (err, v) {
results[index] = v;
callback(err);
} undefined
pages/account/orders/invoice function (err, v) {
results[index] = v;
callback(err);
} undefined
pages/account/orders/details function (err, v) {
results[index] = v;
callback(err);
} undefined
pages/custom/page/narrow-page function (err, v) {
results[index] = v;
callback(err);
} undefined
{ [Error: ENOENT: no such file or directory, open 'layout/base/function (err, v) {
results[index] = v;
callback(err);
}.html']
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'layout/base/function (err, v) {\n results[index] = v;\n callback(err);\n }.html' }
/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:27
return callback(err);
^
TypeError: callback is not a function
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:27:20
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:92:20
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:998:13)
at /Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/node_modules/async/dist/async.js:906:16
at ReadFileContext.callback (/Users/myusername/.nvm/versions/node/v4.2.1/lib/node_modules/@bigcommerce/stencil-cli/lib/template-assembler.js:113:24)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)