I get the following when I run yo webapp from the cmd line after following http://www.youtube.com/watch?feature=player_embedded&v=zBt2g9ekiug to about 3 minutes. Has anyone seen this before?
C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\node_modules\cheeri
o\node_modules\entities\index.js:36
return encode[level](data);
^
ReferenceError: encode is not defined
at Object.exports.encode (C:\Users\L\AppData\Roaming\npm\node_modules\genera
tor-webapp\node_modules\cheerio\node_modules\entities\index.js:36:9)
at exports.encode (C:\Users\L\AppData\Roaming\npm\node_modules\generator-web
app\node_modules\cheerio\lib\utils.js:41:50)
at formatAttrs (C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp
\node_modules\cheerio\lib\render.js:30:32)
at renderTag (C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\n
ode_modules\cheerio\lib\render.js:113:18)
at C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\node_modules
\cheerio\lib\render.js:81:17
at Array.forEach (native)
at Function._.each._.forEach (C:\Users\L\AppData\Roaming\npm\node_modules\ge
nerator-webapp\node_modules\cheerio\node_modules\underscore\underscore.js:79:11)
at module.exports (C:\Users\L\AppData\Roaming\npm\node_modules\generator-web
app\node_modules\cheerio\lib\render.js:77:5)
at Object.exports.html (C:\Users\L\AppData\Roaming\npm\node_modules\generato
r-webapp\node_modules\cheerio\lib\static.js:40:12)
at Appgenerator.domUpdate (C:\Users\L\AppData\Roaming\npm\node_modules\gener
ator-webapp\node_modules\yeoman-generator\lib\actions\wiring.js:44:14)
I had same issue when follow tutorial with latest Yomen version.
There is typo error in entities library that You can manually fix to complete tutorial:
Open file with error (in your case C:\Users\L\AppData\Roaming\npm\node_modules\generator-webapp\node_modules\cheerio\node_modules\entities\index.js ) and change variable name from inverse to encode
var decode = levels.map(function(l){ return l.normal; }),
decodeStrict = levels.map(function(l){ return l.strict; }),
inverse = levels.map(function(l){ return l.inverse; });
To
var decode = levels.map(function(l){ return l.normal; }),
decodeStrict = levels.map(function(l){ return l.strict; }),
encode = levels.map(function(l){ return l.inverse; });
One workaround is to use the cg-angular yeoman generator:
sudo npm install -g generator-cg-angular
yo cg-angular
Obviously not ideal if you're following a tutorial though.
Also happening in OSX for angular generator:
/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/node_modules/entities/index.js:36
return encode[level](data);
^
ReferenceError: encode is not defined
at Object.exports.encode (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/node_modules/entities/index.js:36:9)
at exports.encode (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/lib/utils.js:41:50)
at formatAttrs (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/lib/render.js:30:32)
at renderTag (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/lib/render.js:114:18)
at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/lib/render.js:82:17
at Array.forEach (native)
at Function._.each._.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/node_modules/underscore/underscore.js:78:11)
at module.exports (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/lib/render.js:78:5)
at Object.exports.html (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/cheerio/lib/static.js:40:12)
at Generator.domUpdate (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/lib/actions/wiring.js:39:14)
The Node module entities just released a new version breaking a dependency (cheerio) of yeoman.
Error seems to originate to cheerio. Issue opened here https://github.com/MatthewMueller/cheerio/pull/382
Related
I'm trying to use Moment.js library in Zapier. The documentation says that it's available. However, when I add this line:
var moment = require('moment');
I keep getting this error:
Bargle. We hit an error creating a run javascript. :-( Error:
Error: Cannot find module 'moment'
If I remove the declaration, I get ReferenceError: moment is not defined
moment is not available in https://zapier.com/help/code/ - maybe you are thinking of https://zapier.com/developer/documentation/v2/scripting/?
I can understand how one could confuse the two - but one is a simple code step in a Zap, the other is how partners developer applications on Zapier.
Moment library is available in Zapier, no need to call(require) it. Here's a snippet of code where I have used it.
var date;
if (outbound.Date === undefined) {
var d = moment();
var n = d.format();
date = n.split('.');
outbound.Date = date[0];
}
I'm developing Thunderbird addon that uses libedataserver.so.
Addon uses js-ctypes to call e_source_registry_new_sync from the above library. See below code:
var lib = ctypes.open("libedataserver-1.2.so.18");
var GCancellable = {};
GCancellable.cls = new ctypes.StructType("GCancellable");
var GError = {};
GError.cls = new ctypes.StructType("GError");
var ESourceRegistry = {};
ESourceRegistry.cls = new ctypes.StructType("ESourceRegistry");
ESourceRegistry.e_source_registry_new_sync =
lib.declare(
"e_source_registry_new_sync",
ctypes.default_abi,
ESourceRegistry.cls.ptr,
GCancellable.cls.ptr,
GError.cls.ptr.ptr);
//below line causes an error
var sourceRegistry = ESourceRegistry.e_source_registry_new_sync(null, null);
It works perfectly fine on Ubuntu however on Fedora 21 it prints below output and hangs:
(thunderbird:2735): GLib-GObject-WARNING **: cannot register existing type 'EDBusSource'
(thunderbird:2735): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
(thunderbird:2735): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(thunderbird:2735): GLib-GObject-WARNING **: invalid cast from 'EDBusSourceProxy' to '<invalid>'
I'm using Fedora 21 with evolution-data-server 3.12.11-1.fc21.
Ubuntu uses evolution-data-server 3.12.10.
I developed simple C application that calls e_source_registry_new_sync and it works perfectly fine.
Can someone suggest what might be the reason of this issue?
#UPDATE:
I raised a Fedora bug. According to Fedora maintainers issue is caused by loading libedataserver twice (my code and evolution-ews):
The problem seems to be that thunderbird loads libedataserver-1.2.so.18 on its own, while the libcamelews.so has a runtime dependency on libedataserver-1.2.so, but this is not (in runtime) satisfied by the thunderbird-loaded libedataserver-1.2.so.18, thus it is loaded again, which breaks the GLib type system.
Please comment if there is something I can do from addon side.
You are asking about the error happening with this function: https://developer.gnome.org/libedataserver/stable/ESourceRegistry.html#e-source-registry-new-sync
The docs state that on error, NULL is returned and GError is set appropriately. I 'll test the code later and see what's up but I'll tell you here how to test it yourself.
GError is not an opque structure. Define it like this:
var GQuark = ctypes.uint32_t;
GError.cls = new ctypes.StructType('GError', [
{'domain': GQuark},
{'code': ctypes.int},
{'message': ctypes.char.ptr}
]);
Taken from here: https://gist.github.com/Noitidart/dbe54fcd7794c8ddff6f#file-_ff-addon-snippet-gdk_giolaunch-js-L22
Then set up your code to return error like this:
var error = GError.cls.ptr(); // can use `null` if we dont care to see error but we want to know what is happening so we can fix it
var sourceRegistry = ESourceRegistry.e_source_registry_new_sync(null, error.address());
if (sourceRegistry.isNull()) {
console.error('An error occured when calling e_source_registry_new_sync!');
console.info('ERROR DETAILS', 'Domain:', error.contents.domain.toString(), 'Code:', error.contents.code, 'Message:', error.contents.message.readString());
}
Then based on the error details look up that code and message and it will tell you what's up, then search StackOverflow or wherever for a solution to it if it's not obvious.
So I am trying to make a game in Dart and I decided to check out this asset_pack package. I tried to test the example code (below) but asset.imported prints null..why is this?
I did create /web/test/foo.txt in my project folder and put a little bit of text in it but still I get null printed.
main() {
// Construct a new AssetManager.
AssetManager assets = new AssetManager();
// Register the 'test' pack. No url is needed so the empty string suffices.
AssetPack testPack = assets.registerPack('test', '');
// Register asset 'foo' and load it's contents from 'foo.txt'.
// The asset type is 'text' and there are no arguments for the loader
// or importer.
Future<Asset> futureAsset = testPack.loadAndRegisterAsset('foo', 'foo.txt',
'text', {}, {})
futureAsset.then((asset) {
// Print the contents of foo.txt.
print(asset.imported);
});
}
I think your file has to be in the web/ folder or you have to load test/foo.txt. If you run the example you should see an error that the file was not found in the developer console. This code seems to work:
Future<Asset> futureAsset = testPack.loadAndRegisterAsset('foo', 'text',
'test/foo.txt', {}, {})
It seems quite hard to get the AngularJS/Karma end-to-end testing environment working with a Rails backend.
I have Karma installed and running with the following config file:
basePath = '../';
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
autoWatch = false;
browsers = ['Chrome'];
// singleRun = true;
proxies = {
'/': 'http://local.mywebsite.com:3000/'
};
urlRoot = 'e2e';
junitReporter = {
outputFile: 'test_out/e2e.xml',
suite: 'e2e'
};
Where http://local.mywebsite.com:3000/ is my rails application.
I try a very simple test:
it('should redirect to /', function() {
expect(browser().location().url()).toBe("/");
});
But I am stuck with the following error:
http://localhost:9876/base/test/e2e/scenarios.js:8:5
TypeError: Object [object Object] has no method 'resumeBootstrap'
at HTMLIFrameElement.<anonymous> (http://localhost:9876/adapter/lib/angular-scenario.js:26285:27)
at HTMLIFrameElement.jQuery.event.dispatch (http://localhost:9876/adapter/lib/angular-scenario.js:3064:9)
at HTMLIFrameElement.elemData.handle.eventHandle (http://localhost:9876/adapter/lib/angular-scenario.js:2682:28)
at k (http://connect.facebook.net/en_US/all.js:48:745)
Where scenarios.js comes from https://github.com/angular/angular-seed.
Any idea how to make it work?
Try
it('should redirect to /', function() {
browser().navigateTo("/");
expect(browser().window().path()).toBe("/");
});
I would get the most up-to-date version of angular scenario runner. You can find the unstable version at
http://code.angularjs.org/1.1.4/angular-scenario.js
and the stable version at
http://code.angularjs.org/1.0.6/angular-scenario.js
Then, be sure to update your karma configuration to use the newest scenario runner
files = [
'path/to/angular-scenario.js',
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
Hopefully that helps.
The solution above is correct. This link covers the problem: https://github.com/karma-runner/karma/issues/470
I hit the same issue while running the excellent examples on: http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-testacular.html
That's a great resource if you're getting started, but you will need to update from testacular to karma and update angularjs to 1.0.6
I am using Symfony 1.2 and I have some issues switching context.
This code was working fine:
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('account', 'prod', false);
$context = sfContext::createInstance($configuration, 'account-prod');
$userToLogin = PcUserPeer::retrieveByEmailAddress("myemail#example.com");
Auth::login($context->getUser(), $userToLogin, false, false);
echo "all done.";
At some point requirements changed and I needed to use the 'public' application before the 'account' one.
Then I changed to:
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
// {{{ new code:
$configuration = ProjectConfiguration::getApplicationConfiguration('public', 'prod', false);
sfContext::createInstance($configuration);
// some code using the public app...
// }}}
$configuration = ProjectConfiguration::getApplicationConfiguration('account', 'prod', false);
$context = sfContext::createInstance($configuration, 'account-prod');
// {{{ new code:
sfContext::switchTo('account-prod');
// }}}
$userToLogin = PcUserPeer::retrieveByEmailAddress("myemail#example.com");
CustomAuth::login($context->getUser(), $userToLogin, false, false);
echo "all done.";
Basically I added a switchTo call.
After the change, the code got broken and the error message is this:
PHP Fatal error: Call to a member function prepare() on a non-object in /var/www/html/myproj/symfony/storage/sfPDOSessionStorage.class.php on line 109
Thanks for your help,
Dan
Symfony is trying to load the session storage object. I suppose there is a problem with your new environment's configuration.
Check
/apps/public/config/factories.yml
Look for "storage" and try to find out how is it different from the other app's configuration.
Hard to know without a backtrace/more info what is triggering the error. It looks like you are using sessions stored in a database, and that a query related to that is failing.
Try setting the third argument to getApplicationConfiguration to true (which will turn debug on) and see if you get more output.
At a guess, it looks like the account app is using PDO session storage, and is failing to connect to the database or something?