" 'app' is undefined " when developing an Office add-in - javascript

So I am learning how to develop an MS Project add-in.
I was successful in deploying the tutorial (yayy!): https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/project-quickstart
Then I replaced the html and the js code with the example code from here: https://dev.office.com/reference/add-ins/shared/projectdocument.gettaskbyindexasync
And it stopped working!
I started a new project from scratch. Again, as in the tutorial, "Office Add-in project using Jquery framework", "Javascript" as selected options.
And it still didn't work.
Error message from F12 dev tools:
jQuery.Deferred exception: 'app' is undefined ReferenceError: 'app' is undefined
at Anonymous function (eval code:14:13)
at mightThrow (https://localhost:3000/node_modules/jquery/dist/jquery.js:3534:10)
at Anonymous function (https://localhost:3000/node_modules/jquery/dist/jquery.js:3602:12) undefined
SCRIPT5009: 'app' is undefined
jquery.js (3827,3)
The error is spawned from the following row from the JS code:
app.initialize();
There is no "app.initialize();" in the tutorial. If I decide to delete this row, the error goes away (naturally), but then interacting with the functionality spawns another error message:
Unable to get property 'push' of undefined or null reference
Then I tried to define some 'app' Object.
I initialized it with
var app = Object.context;
The error then is:
Unable to get property 'initialize' of undefined or null reference
I am still trying to figure out, where this 'app' Object comes from. Or at least, how can I define it properly. Any ideas?

Related

while using the prerender cli, terminal gives TypeError: Cannot read property 'endsWith' of undefined

I have been trying to implement this plugin using the cli in my Vue app (Vue 3)
vue add prerender-spa
. After I am done with the cli, I get this error.
� Invoking generator for Vue-cli-plugin-prerender-spa...
⚓ Running completion hooks...
ERROR TypeError: Cannot read property 'endsWith' of undefined
TypeError: Cannot read property 'endsWith' of undefined
at C:\Users\hp\Documents\WebDev\projects\VueAndFirebase\learnvue\Myprerender-attempt\dojo-blog\node_modules\vue-cli-plugin-prerender-spa\generator.js:22:42
at runGenerator (C:\Users\hp\AppData\Roaming\npm\node_modules\#vue\cli\lib\invoke.js:132:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async invoke (C:\Users\hp\AppData\Roaming\npm\node_modules\#vue\cli\lib\invoke.js:92:3)
What could be the problem, or should I just abandon this pre-rendering and focus on SSR(Nuxt.js). Although the app is a small one and based on my findings, SSR is overkill. It is giving me too much headache.

polymer.html: Uncaught TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'

I have a Polymer web component that works stand-alone. However, upon bringing it into my app, I am getting a TypeError about dispatchEvent:
Uncaught TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'
I am debugging this now but wanted to post this, as there isn't currently another single result that I can find about this error specifically related to Polymer.
The problem was that an earlier version of JayData is not compatible with webcomponents.
I was using JayData and was on version 1.3.6.
I've downloaded and updated to the latest version (1.5.6) and this has fixed the problem.

Uncaught ReferenceError: Meteor is not defined

I'm following a tutorial to create a Meteor app and I've been having the same error regarding different things in the developer console.
> Meteor.users.find().count();
VM2034:1 Uncaught ReferenceError: Meteor is not defined(…)(anonymous function) # VM2034:1
> Session.set('pageTitle', 'A different title');
VM2035:1 Uncaught ReferenceError: Session is not defined(…)
From researching the problem, the 2 solutions that come up are: (1) doing
meteor add session
which I have done; (2) updating the Meteor version but I am running Meteor 1.3.3. Neither works.
EDIT: After doing meteor update, the Meteor error disappeared once but came back the second time I tried a command based on Meteor.
Any idea on how to solve this?
If you are trying to set the session outside the client folder you will get this error. Which is why you must do:
if(Meteor.isClient) {
Session.set('pageTitle', 'A different title');
}
Then you can check it worked simple write in console:
Session.get('pageTitle')
Will output: "A different title"
Good luck!

Discover Meteor, Chapter 3-5: plain grey screen and no data

This is a follow-up question on Meteor: "=> Exited with code: 8" error.
Since Chapter 3 of Discover Meteor, whenever I run the server and visit the http://localhost:3000/ URL (or any other page of the app), I only get a plain, grey screen, with nothing on it:
I decided to go on with the tutorial, hoping that the next chapters would result in fixing what was wrong by updating some files, but it did not.
There is no error in the server log, so I cannot reproduce them here.
However, you can find all the files of the project on GitHub: https://github.com/thibaudclement/microscope
UPDATE: here are the client-side console logs:
Uncaught TypeError: Template.__create__ is not a function
meteor.js:225 Uncaught TypeError: Cannot read property 'prototype' of undefined
iron-router.js:1475 Uncaught TypeError: undefined is not a function
global-imports.js:3 Uncaught TypeError: Cannot read property 'RouteController' of undefined
template.layout.js:2 Uncaught ReferenceError: Template is not defined
template.loading.js:2 Uncaught ReferenceError: Template is not defined
template.post_item.js:2 Uncaught ReferenceError: Template is not defined
template.post_page.js:2 Uncaught ReferenceError: Template is not defined
template.posts_list.js:2 Uncaught ReferenceError: Template is not defined
template.main.js:2 Uncaught ReferenceError: Template is not defined
router.js:1 Uncaught ReferenceError: Router is not defined
post_item.js:1 Uncaught ReferenceError: Template is not defined
posts_list.js:1 Uncaught ReferenceError: Template is not defined
posts.js:1 Uncaught ReferenceError: Meteor is not defined
meteor.js:888 Exception in defer callback: TypeError: Cannot read property 'insert' of undefined
at Utils.extend.autoRender (http://localhost:3000/packages/iron-router.js?af9f4791b8af4582a37d93bcade1eed163a976a8:1636:17)
at http://localhost:3000/packages/iron-router.js?af9f4791b8af4582a37d93bcade1eed163a976a8:1465:16
at _.extend.withValue (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:955:17)
at http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:435:45
at Object.<anonymous> (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:983:22)
at onGlobalMessage (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:372:23)
Any idea of what I am doing wrong?
Or at least, where I should start looking to find what is going wrong?
Problem may be you're following old version of the book or with microscope(not sure)
I cloned your app and tried to run
in your .meteor/packages file
change
iron-router
spin
to
iron:router
sacha:spin
it is working fine for me afer these changes

Page not launching with AngularSeed on Firebase URL

I followed in detail the five minute tutorial at: https://www.youtube.com/watch?v=hj0LyZ13D3Q
I executed the following steps:
I set up an account at Firebase.com
I set up a new app within my Firebase account
I opened my terminal and:
sudo npm install -g firebase-tools
firebase login (followed by email and password for firebase.com)
firebase bootstrap
selected the new app as listed from Firebase
chose the angular template
cd to the newly created directory
firebase login
On the video, the new site is up and running at https://newapp.firebaseapp.com
In my case I get nothing but a blank screen and my JS console provides nothing but a series of errors:
GET https://myapp.firebaseapp.com/bower_components/html5-boilerplate/css/normalize.css myapp.firebaseapp.com/:9
GET https://myapp.firebaseapp.com/bower_components/html5-boilerplate/css/main.css myapp.firebaseapp.com/:10
GET https://myapp.firebaseapp.com/bower_components/angular/angular.js myapp.firebaseapp.com/:33
GET https://myapp.firebaseapp.com/bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js myapp.firebaseapp.com/:12
GET https://myapp.firebaseapp.com/bower_components/angular-route/angular-route.js myapp.firebaseapp.com/:34
GET https://myapp.firebaseapp.com/bower_components/firebase/firebase.js myapp.firebaseapp.com/:35
GET https://myapp.firebaseapp.com/bower_components/firebase-simple-login/firebase-simple-login.js myapp.firebaseapp.com/:36
GET https://myapp.firebaseapp.com/bower_components/angularfire/dist/angularfire.js myapp.firebaseapp.com/:37
Uncaught ReferenceError: angular is not defined app.js:4
Uncaught ReferenceError: angular is not defined config.js:4
Uncaught ReferenceError: angular is not defined controllers.js:5
Uncaught ReferenceError: angular is not defined decorators.js:9
Uncaught ReferenceError: angular is not defined directives.js:6
Uncaught ReferenceError: angular is not defined filters.js:5
Uncaught ReferenceError: angular is not defined routes.js:3
Uncaught ReferenceError: angular is not defined services.js:6
Uncaught ReferenceError: angular is not defined firebase.utils.js:3
Uncaught ReferenceError: angular is not defined simpleLogin.js:2
Uncaught ReferenceError: angular is not defined
I'm using Node v0.10.32, Firebase Command Line Tools Version 1.1.2
For whatever reason, the tutorial omited the bower angular bower_components. https://github.com/firebase/generator-angularfire
I copied and pasted them from another project and put the corresponding scripts from the other project in the head of my index.html and it works.

Categories