Cannot find name 'console' - meteor

I am using Angular2-Meteor, TypeScript. (Meteor version 1.3.2.4)
When I use console.log('test'); on the server side, it is working well.
However, I got this warning in my terminal:
Cannot find name 'console'.
How can I get rid of this warning?
Or is there any special method such as Meteor.log for server side? Thanks

How can I get rid of this warning?
if its a TypeScript compiler warning (and not a runtime one) then console is defined in lib.d.ts : https://basarat.gitbooks.io/typescript/content/docs/types/lib.d.ts.html
Make sure that the compiler is setup correctly (e.g. doesn't have --noLib or some custom incorrect --lib). You might want to look at your tsconfig.json's compilerOptions (if any)

#barbatus who is main contributor for angular2-meteor, gave the answer on Github.
The issue is in that TypeScript package uses lib.core.ts default lib on the server side which doesn't have definitions for console. NodeJS definitions from other side as now defines console in the global scope only (i.e. global.console).
The solution is running this in your terminal:
typings install registry:env/meteor --ambient
Please go here for more details.

Related

How do I fix the error: Cannot find module '__sveltekit/paths' in sveltekit when migrating to 1.7.2?

I was migrating to sveltekit 1.7.2 from 1.5.3, as there was a security vulnerability. NPM did not tell me that 1.7.2 was a breaking change, so I installed the new version. I found that the latest compatible version was 1.5.6, anything higher resulted in the same error. I don't know why this is an issue, I guess it wouldn't be if you were making a new project, but as I am not doing that, can anyone tell me how to fix this?
Entire error:
Error: Cannot find module '__sveltekit/paths' imported from [path to project]/node_modules/#sveltejs/kit/src/runtime/server/respond.js'
at nodeImport (file:///[path to project]/vite/dist/node/chunks/dep-3007b26d.js:52431:25)
at ssrImport (file:///[path to project]/node_modules/vite/dist/node/chunks/dep-3007b26d.js:52354:20)
at eval (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:5:37)
at async instantiateModule (file://path to project]/node_modules/vite/dist/node/chunks/dep-3007b26d.js:52400:9)
This error tells me that the file "__sveltekit/paths" has either moved, been replaced, or deleted entirely. Does anyone know where the file is now/if it even still exists?
Please note, that I see this error in the browser and in the node console. No other content is rendered at all.

sharing shiny app with renv throws error due to bslib

I wanted to make internally sharing/locally launching a shiny app developed with the {golem} framework a little more robust.
Hence, I used the renv package and installed the shiny app as a local package into a project folder.
I proceeded as follows (thanks #Kat for the suggestion):
initialize renv using renv::init(bare = TRUE)
renv::install("my_local_package")
renv::snapshot(type = "all")
renv::isolate()
Writing a launch file consisting of:
library(golempackage)
renv::restore()
golempackage::run_app(options = list(launch.browser = TRUE))
Share folder.
However, when launching the shiny app on a different computer (or a docker testing environment), I get the following error caused by the package bslib. Same happens when I delete my cache:
An error has occurred!
File attachments must exist: 'C:/Users/XYZ/AppData/Local/R/cache/R/renv/cache/v5/.../bslib/lib/bs3/assets/fonts'
Note: this error even occurs if I set the cache to be project-local and share it inside the project folder.
However, now the error message does not reference the global but the project-local cache. Unfortunately still as an absolute path which throws an error for other users.
This is all super weird and I have not the slightest idea why this occurs.
I would like to avoid removing bslib.
As far as I can see, the error is coming from the sass package, e.g.
https://github.com/rstudio/sass/blob/f7a954027447dd0b9826ec01c7084c89a6e64fcc/R/layers.R#L442-L443
While I don't know exactly know what's going on, you could probably use the R debugger to check why that's failing. (Does the referenced folder exist in both cases? Are you expecting renv to be using the cache in the second case?)

command line compiling generates bigger file than the online version

I am testing google closure compiler on command line.
I took the latest version :
java -jar closure-compiler.jar --version
Closure Compiler (http://github.com/google/closure-compiler)
Version: v20190618
Built on: 2019-06-21 17:24
I am generating a compressed version of my javascript like this :
java -jar closure-compiler.jar my_script.js > out.js
The problem is that the generated code is bigger than the one I get when I use the online service at https://closure-compiler.appspot.com/home
I noticed that the command line version added, at the beginning, the following code :
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,c,b){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(c.call(b,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,c,b,d){if(c){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:c})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
I do not have such a code in my script: Where does it come from ?
how can I produce the same output as the online version ?
To get the compiler command line work as the web service, I just added an option :
--language_out=ECMASCRIPT_2015
This is likely a discrepancy between the settings on the web service and the ones you're using locally.
Have a look at a Closure Compiler: Flags and Options to see what settings you might prefer.
If you'd share your source, it'd be possible to try and help you narrow down the options.
As for the extra code, I believe it is at least partially a polyfill for Array.prototype.find (aka [].find), which I assume is in your code?
If so, that's Closure injecting code to improve your cross browser compatibility.

How to get rid of the "Realm.framework/Realm is not a dylib" warning?

I am using Realm for our Objective-C iOS app, installed via CocoaPods. However I wasn't able to get rid of the following warning message:
ld: warning: Auto-Linking supplied '/{App_Directory}/Realm.framework/Realm', framework linker option at /{App_Directory}/Realm.framework/Realm is not a dylib
Is there any solution about it? Thank you very much!
Taking another look at that, it seems like you'd somewhere in your project a misconfigured build setting, which contained literally {App_Directory}, which won't be substituted as a variable because of the missing leading dollar sign, assuming that you defined yourself App_Directory as a build setting. It might be better to just use $SRCROOT for that purpose, if that's suitable as well.

Meteor Jade Handlebars on Windows 8 - Jade compiler error: Cannot read property 'length' of undefined

I'm attempting to use jade in meteor with this package https://github.com/SimonDegraeve/meteor-jade-handlebars
I'm on a windows machine. I've so far managed to use most meteorite packages by following the instructions here (www.discovermeteor.com/2013/03/20/using-meteor-and-atmopshere-on-windows/)
When i run 'meteor' on my project with .jade files, I'm getting this error:
While building the application:
client\todos.jade: Jade compiler error: Cannot read property 'length' of undefin
ed
=> Your application has errors. Waiting for file change.
Terminate batch job (Y/N)?
I tried to use this new fork too -> https://github.com/kynan/meteor-jade-handlebars/tree/refactor-for-meteor-0.6.5
Same problem.
I further tested this in a Linux machine and it works perfectly. I have no idea why this is failing with the above mention error on windows.
Try adding a blank extra line to the end of your file. For example, an extra line would be needed here.
template(name="name")
h1 Hello!
I've been dealing with a lot of problems getting jade-templating to work with meteor, but finally got it to work.. Here's how:
Add this to smart.json, belt-jade-handlebars is jade for newer versions of meteor:
"packages": {
"belt-jade-handlebars": {}
}
Add this to .meteor/packages:
belt-jade-handlebars
And finally add the extra blank line to all *.jade files. ( suggested by user3064375 )
Start the app by using:
$ meteor run --release template-engine-preview-3
This will use the latest template engine and start meteor.

Resources