【发布时间】:2016-06-08 23:20:20
【问题描述】:
我正在使用autoprefixer 和postcss,在移动到新的 linux 服务器后一定有问题,但我不知道这可能是什么。我收到了错误:
/home/ec2-user/Enviziion/Muveoo/Server/node_modules/postcss/lib/lazy-result.js:157
this.processing = new Promise(function (resolve, reject) {
^
ReferenceError: Promise is not defined
触发原因:
var autoprefixer = require('autoprefixer');
var postCSS = require('postcss');
function prefix(css, res, type, fullPath) {
postCSS([autoprefixer]).process(css).then(function(result) {
var css = result.css;
var length = css.length;
res.writeHead(200, {
'Content-Length' : length,
'Content-Type' : type
});
res.write(css);
res.end();
});
}
我研究了这个问题,但所有出现的问题似乎都是针对极早期版本的 node.js,例如:
而且解决方案似乎总是“更新节点”。
但我的似乎是最新的:
[ec2-user@ip-172-31-22-79 Server]$ node -v
v5.7.0
我的问题可能在这里?
【问题讨论】:
-
你能试试这个命令吗:哪个节点
-
@Alexandre
~/.nvm/versions/node/v5.7.0/bin/node -
@Alexandre 我没有使用 gulp,但我假设您希望我尝试删除我的节点模块文件夹并重新安装软件包,我会尝试的。
-
@Alexandre 好的,我尝试删除节点模块文件夹,并重新安装所有必需的包,我什至尝试安装 es6-promise。错误没有改变。编辑:没关系,使用 es6-promise 确实有效。