nodeJS phantom ReferenceError: Promise is not defined
nodeJS phantom ReferenceError: Promise is not defined
问题
我安装了幻影并使用节点v0.10.26
我在幻影中得到了一个Promise错误。我没有看到任何需要安装的依赖项。
下面是我使用的幻影的示例代码
/myProject/node_modules/farmon/lib/index.js:15返回new Promise(函数(解析){^ReferenceError:未定义Promise在Object.module.exports.create(/Users/jbyrne/git/tin-validator/node_modules/fammon/lib/index.js:15:14)在对象处。(/Users/jbyrne/git/tin-validator/fintom.js:6:9)在模块中_compile(模块.js:456:26)位于Object.Module_extensions..js(Module.js:474:10)在Module.load(Module.js:356:32)位于Function.Module_load(Module.js:312:12)位于Function.Module.runMain(Module.js:497:10)启动时(node.js:119:16)在node.js:902:3
我将节点升级到v0.11.13,现在$node phantom.js异常:ReferenceError:未定义映射
我安装了幻影并使用节点v0.10.26
我在幻影中得到了一个Promise错误。我没有看到任何需要安装的依赖项。
下面是我使用的幻影的示例代码
/myProject/node_modules/farmon/lib/index.js:15返回new Promise(函数(解析){^ReferenceError:未定义Promise在Object.module.exports.create(/Users/jbyrne/git/tin-validator/node_modules/fammon/lib/index.js:15:14)在对象处。(/Users/jbyrne/git/tin-validator/fintom.js:6:9)在模块中_compile(模块.js:456:26)位于Object.Module_extensions..js(Module.js:474:10)在Module.load(Module.js:356:32)位于Function.Module_load(Module.js:312:12)位于Function.Module.runMain(Module.js:497:10)启动时(node.js:119:16)在node.js:902:3
我将节点升级到v0.11.13,现在$node phantom.js异常:ReferenceError:未定义映射
代码
var phantom = require('phantom');
var sitepage = null;
var phInstance = null;
phantom.create()
.then(function(instance) {
phInstance = instance;
return instance.createPage();
})
.then(function(page) {
sitepage = page;
return page.open('https://stackoverflow.com/');
})
.then(function(status) {
console.log(status);
return sitepage.property('content');
})
.then(function(content) {
console.log(content);
sitepage.close();
phInstance.exit();
})["catch"](function(e) {
console.error('Exception: %s', e);
});
PhantomJS的版本依赖于节点0.10中不存在的一些全局对象。您可以将Node升级到最新的稳定版本,也可以将PhantomJS降级到1.x.
如果要在Node版本之间切换,则可以使用nvm轻松切换。
将节点升级到0.12提到的错误是由于phantom中的new Map()行引起的。Map构造函数添加到节点0.12
- jQuery is not loaded
- reactRedux is not defined
- ReferenceError: cordova is not defined @ng-cordova.min.js:7
- Tomcat websocket is not working
- NodeJS Multer is not working
- React, Webpack: bundle.js is not generated
- jQuery is not defined - WordPress footer.php
- GAPI Is Not Defined
- Mouse Out Orange Div "CurrentHeight" is not applyi
- Rxjs5, distinct() is not working
- Page_ClientValidate is not defined
- ReferenceError: $firebase is not defined
- ReferenceError: crimeID is not defined
- AngularJS: $scope is not defined?
- Backbone + RequireJS: Collection.each() is not working
- Jquery Cropbox is not working
- ajaxUrl is not defined
- WebView: Uncaught ReferenceError: Android is not defined
- jquery .on() is not triggering
- $.html is not having textarea value