I am trying to use tojocky/node-printer library in meteorJS app.
I did following to install
meteor npm install --save node-printer
But when I try to use it, It doesnt seem to be working.
Following is my code snippet
import { printer } from 'node-printer';
import './mainLayout.html';
Template.mainLayout.helpers({
printers: function() {
return printer.getPrinters();
}
});
I get following error
Exception in template helper: TypeError: Cannot read property 'getPrinters' of undefined
What am I missing here? Any help would be appreciated.
I cant use this module.
Its server only.
It doesn't let you print from client browser.
Hope this helps anyone else trying to do this in future.
Related
I'm want to play around with building desktop applications using Electron and Vue.
Now I got an idea where I want to tail a local .txt file using node-tail, and store these changes somewhere. I saw this app also doing this, so I thought I would be able to do something similar within a Vue/Electron app.
With everything installed and trying to run this code with yarn electron:dev:
import { Tail } from 'tail';
let tail = new Tail("C:/logs/somelog.txt");
tail.on("line", function(data) {
console.log(data);
});
tail.on("error", function(error) {
console.log('ERROR: ', error);
});
I get this error:
Uncaught TypeError: Class extends value undefined is not a constructor or null
I did some searching on the error, and most of the results said removing your node_modules folder and npm i again could help, but this didn't do the trick.
Also I saw someone comment that these problems might happen if you mix yarn and npm. Now I did install everything at first using yarn and then the node-tail package using npm. This person said the same about removing and installing again. But this doesn't work for me.
Not sure Why I am getting this issue. I am following a react-native tutorial, and am experiencing this error:
TransformFile(filePath, transformOptions) {
var _this3 = this;
return _asyncToGenerator(function*() {
// We need to be sure that the DependencyGraph has been initialized.
// TODO: Remove this ugly hack!
yield _this3._depGraphPromise;
return _this3._transformer.transformFile(filePath, transformOptions);
})();
This problem usually happens because the user is using a node version thats newer. You can solve this by downgrading your node using Nvm. Here is the Link to Using Nvm, https://www.npmjs.com/package/nvm. Let me know if you have any further questions :)
I initiated a basic ReactJS app using npx create-react-app, then I ejected using npm run eject. Now when I am trying to import the Casual library by import casual from 'casual';, I get the following error:
Compiled with problems:
ERROR in ./node_modules/casual/src/casual.js 3:13-37
Module not found: Error: Can't resolve 'fs'
in '/home/me/project/node_modules/casual/src'
And the code around line number 3 in casual.js looks like this:
var helpers = require('./helpers');
var exists = require('fs').existsSync;
var safe_require = function(filename) {
if (exists(filename + '.js')) {
return require(filename);
}
return {};
};
...
I found answers to similar questions. Those were mainly Node or Angular related. I also tried answers suggesting some changes in webpack config, but no luck.
The reason is Casual doesn't work on the front end. It runs on Node.js only.
You need to install maybe a new package to make things work.
Fs is unavailable on the browser so it won't work. Instead, you should use casual-browserify, it will work on browsers.
I am following Josh Morony's tutorial with the following URL.
https://www.joshmorony.com/creating-role-based-authentication-with-passport-in-ionic-2-part-1/
https://www.joshmorony.com/creating-role-based-authentication-with-passport-in-ionic-2-part-2/
The published date is not too old as it was published in Jan 2018. Unfortunately, I can't get it running. Too much errors. Can someone provide a working code for me to learn ? Some of the code is also invalid in some point which I managed to fix. But I still cannot get it running. Hope that you can help.
After I followed the tutorial below
https://www.joshmorony.com/creating-role-based-authentication-with-passport-in-ionic-2-part-2/
I ran the command ionic serve to test out the application, there I received the following error
Typescript Error
Cannot find module 'ionic-native'.
...Application/Development/Cordova/josh1/client/todo->roles/src/app/app.component.ts
import { Platform } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
I checked online and found out that I need to replace
import { StatusBar } from 'ionic-native';
with
import { StatusBar } from '#ionic-native/status-bar';
After I changed it, i received the following error,
Property 'styleDefault' does not exist on type 'BarProp'.
..Application/Development/Cordova/josh1/client/todo->roles/src/app/app.component.ts
statusbar.styleDefault();
});
The solution to it is that i need to comment out statusbar.styleDefault();
The last ionic serve command I ran shows the following error :
Runtime Error
Can't resolve all parameters for Storage: (?)
Stack
Error: Can't resolve all parameters for Storage: (?).
at syntaxError (http://localhost:8100/build/vendor.js:80025:34)
at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8100/build/vendor.js:95245:35)
at CompileMetadataResolver._getTypeMetadata (http://localhost:8100/build/vendor.js:95080:26)
at CompileMetadataResolver._getInjectableMetadata (http://localhost:8100/build/vendor.js:95060:21)
at CompileMetadataResolver.getProviderMetadata (http://localhost:8100/build/vendor.js:95420:40)
at http://localhost:8100/build/vendor.js:95331:49
at Array.forEach ()
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/vendor.js:95291:19)
at CompileMetadataResolver.getNgModuleMetadata (http://localhost:8100/build/vendor.js:94859:50)
at JitCompiler._loadModules (http://localhost:8100/build/vendor.js:113952:87)
I am really lost here. No other meaningful error description provided. If you have tried the following tutorial, can you provide some assistance ?
I have downloaded all the packages for Tweenlite. npm install and and yarn add all my REACT and node dependencies . For Some reason an error in the console tells me: Quint is undefined Heres the code that its specifically pointing to:
function setupParallax(){
document.addEventListener('mousemove',(event)=>{
let x=event.pageX;
let y=event.pageY;
TweenLite.to(parallax,1,{
x:((x/canvas.width)*2)-1,
y:((y/canvas.height)*2)-1,
ease:Quint.easeOut,
onUpdate:()=>{
renderer.parallaxX=parallax.x;
renderer.parallaxY=parallax.y;
}
})
});
}
Has anyone gone into the same problem? Please help - THANKS in advance.
That is because TweenMax uses its own syntax for Easing.
Quint is not part of the syntax. your choices are:
Power0
Power1
Power2
Power3
Power4
Back
Elastic
Bounce
Rough
SlowMo
Stepped
Circ
Expo
Sine
and Custom
Use this URL to get your easing equasion