PluginError during publication error in parsing: Unexpected token => - javascript

Im trying to make a publication of a webapp into a server(WindowsServer2012), Im using .NET Visual Studio 2019,
When I try to publish it this error pops:
[PluginError: Error in parsing: "Sensores\creadorGraficos.js", Line 14: Unexpected token =>] {
showStack: false,
showProperties: true,
plugin: 'gulp-angular-filesort',
__safety: { toString: [Function: bound ] }
}
Procesar terminados con el código 1.
last sentence translation:
Process ended with code 1
The code is nothing fancy, just a .map :
var presionatmosferica = dataURL.map(function (elemF) {
return elemF.map(o => { return { fecha: o.fecha, presionatmosferica: o.presionatmosferica } })
});
so the problem is the token:
=>
Any idea why this is happening?
By the way, the publication is being made by other PC, my guess was that Gulp was not installed so I run:
npm install gulp
and still the same error.

Related

FundMe project isn't deploying and getting "No deployment found for: MockV3Aggregator"

When I run this command yarn hardhat deploy --tags fundme I'm getting this MockV3Aggregator error.
Error: ERROR processing /Users/mohameduzair/blockChain/JSweb3_2/fundMe_hardhat/deploy/01-deploy-fundMe.js:
Error: No deployment found for: MockV3Aggregator at Object.get (/Users/mohameduzair/blockChain/JSweb3_2/fundMe_hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:162:17)
01-deploy-fundMe.js deploy script
```module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let ethUsdPriceFeedAddress
if (developmentChains.includes(network.name)) {
// if (chainId === 31337) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
const fundMe = await deploy("FundMe", {
from: deployer,
args: [ethUsdPriceFeedAddress],
log: true,
})
log(`FundMe deployed at ${fundMe.address}`)
log(`-------------------------!!!--------------------------`)
}
module.exports.tags = ["all", "fundme"]
```
MockV3Aggregator.sol contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
// pragma solidity >=0.6.6 <0.8.7;
import "#chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol";
I', new to the Blockchain technologies. I'm following a tutorial on Youtube. I've tried my best. still can not fix this.
What should I do now?
Thank you
This is Patrick's tutorial, and you need to first deploy the mock.
Please see here.
After spending 5 hours, I fixed the bug. It was an extra {curly brace} in my code and a deployment error.
If you are following Patrick's tutorial and getting this error then you are probably missing network.name in either of deploy files.
Instead of network.name you have typed only network
Instead of
module.exports.tags = ["all", "fundme"]
in 01-deploy-fundMe.js, use
module.exports.tags = ["all", "mocks"]
and then use command
yarn hardhat deploy --tags mocks
;)

Ember test fail with `testem.js not loaded?`

I'm getting below error message mentioned below for an ember project when running tests locally with ember test.
most of time PhantomJS was hanging.
$ ember test
not ok 1 Chrome - error
---
message: >
Error: Browser failed to connect within 30s. testem.js not loaded?
Stderr:
2018-07-13 11:24:43.115 Google Chrome[47537:547312] Errors logged by ksadmin: KSKeyedPersistentStore store directory does not exist. [com.google.UpdateEngine.CommonErrorDomain:501 - '/Library/Google/GoogleSoftwareUpdate/TicketStore' - 'KSKeyedPersistentStore.m:368']
KSPersistentTicketStore failed to load tickets. (productID: com.google.Chrome) [com.google.UpdateEngine.CoreErrorDomain:1051 - '/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore'] (KSKeyedPersistentStore store directory does not exist. - '/Library/Google/GoogleSoftwareUpdate/TicketStore' [com.google.UpdateEngine.CommonErrorDomain:501])
ksadmin cannot access the ticket store:<KSUpdateError:0x100404060
domain="com.google.UpdateEngine.CoreErrorDomain"
code=1051
userInfo={
function = "-[KSProductKeyedStore(ProtectedMethods) errorForStoreError:productID:message:timeoutMessage:]";
date = 2018-07-13 03:24:43 +0000;
productids = {(
"com.google.Chrome"
)};
filename = "KSProductKeyedStore.m";
line = 102;
NSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore";
NSUnderlyingError = <KSError:0x100515350
domain="com.google.UpdateEngine.CommonErrorDomain"
code=501
userInfo={
date = 2018-07-13 03:24:43 +0000;
line = 368;
filename = "KSKeyedPersistentStore.m";
function = "-[KSKeyedPersistentStore(PrivateMethods) validateStorePath]";
NSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore";
NSLocalizedDescription = "KSKeyedPersistentStore store directory does not exist.";
}
>;
NSLocalizedDescription = "KSPersistentTicketStore failed to load tickets.";
}
>
[47537:28675:0713/112447.920274:ERROR:ssl_client_socket_impl.cc(1026)] handshake failed; returned -1, SSL error code 1, net_error -107
[47537:28675:0713/112448.006779:ERROR:ssl_client_socket_impl.cc(1026)] handshake failed; returned -1, SSL error code 1, net_error -107
2018-07-13 11:24:52.494 Google Chrome Helper[47600:548065] Couldn't set selectedTextBackgroundColor from default ()
Log: |
{ type: 'error',
text: 'Error: Browser failed to connect within 30s. testem.js not loaded?' }
{ type: 'error',
text: '2018-07-13 11:24:43.115 Google Chrome[47537:547312] Errors logged by ksadmin: KSKeyedPersistentStore store directory does not exist. [com.google.UpdateEngine.CommonErrorDomain:501 - \'/Library/Google/GoogleSoftwareUpdate/TicketStore\' - \'KSKeyedPersistentStore.m:368\']\nKSPersistentTicketStore failed to load tickets. (productID: com.google.Chrome) [com.google.UpdateEngine.CoreErrorDomain:1051 - \'/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore\'] (KSKeyedPersistentStore store directory does not exist. - \'/Library/Google/GoogleSoftwareUpdate/TicketStore\' [com.google.UpdateEngine.CommonErrorDomain:501])\nksadmin cannot access the ticket store:<KSUpdateError:0x100404060\n\tdomain="com.google.UpdateEngine.CoreErrorDomain"\n\tcode=1051\n\tuserInfo={\n\t\tfunction = "-[KSProductKeyedStore(ProtectedMethods) errorForStoreError:productID:message:timeoutMessage:]";\n\t\tdate = 2018-07-13 03:24:43 +0000;\n\t\tproductids = {(\n\t\t\t"com.google.Chrome"\n\t\t)};\n\t\tfilename = "KSProductKeyedStore.m";\n\t\tline = 102;\n\t\tNSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore";\n\t\tNSUnderlyingError = <KSError:0x100515350\n\t\t\tdomain="com.google.UpdateEngine.CommonErrorDomain"\n\t\t\tcode=501\n\t\t\tuserInfo={\n\t\t\t\tdate = 2018-07-13 03:24:43 +0000;\n\t\t\t\tline = 368;\n\t\t\t\tfilename = "KSKeyedPersistentStore.m";\n\t\t\t\tfunction = "-[KSKeyedPersistentStore(PrivateMethods) validateStorePath]";\n\t\t\t\tNSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore";\n\t\t\t\tNSLocalizedDescription = "KSKeyedPersistentStore store directory does not exist.";\n\t\t\t}\n\t\t>;\n\t\tNSLocalizedDescription = "KSPersistentTicketStore failed to load tickets.";\n\t}\n>\n[47537:28675:0713/112447.920274:ERROR:ssl_client_socket_impl.cc(1026)] handshake failed; returned -1, SSL error code 1, net_error -107\n[47537:28675:0713/112448.006779:ERROR:ssl_client_socket_impl.cc(1026)] handshake failed; returned -1, SSL error code 1, net_error -107\n2018-07-13 11:24:52.494 Google Chrome Helper[47600:548065] Couldn\'t set selectedTextBackgroundColor from default ()\n' }
1..1
# tests 1
# pass 0
# skip 0
# fail 1
Testem finished with non-zero exit code. Tests failed.
testem.js:
/*jshint node:true*/
module.exports = {
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"Chrome"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
};
installed Versions:
MacOS Sierra 10.12.6
node: 6.12.2
npm: 5.6.0
ember: 2.12.0
ember-cli: 2.18.2
phantomjs: 2.1.1
Below is partial of my tests/index.html file:
<script src="testem.js" integrity=""></script>
<script src="assets/vendor.js"></script>
<script src="assets/test-support.js"></script>
<script src="assets/myApp.js"></script>
<script src="assets/tests.js"></script>
also tried with ember test --server but same error.
So anyone has any idea on how to narrow down this and why testem is not getting loaded ?
For tests usually you need to run chrome in headless mode with enabled remote debugging. Adding these lines to your testem.json should help:
"browser_args": {
"Chrome": [
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222',
'--window-size=1440,900',
]
}
I also suggest to remove "PhantomJS" line - phantom may not work with recent ember versions due to this issue.
Changed testem.js with below settings. and its working fine :)
/* eslint-env node */
module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
'Chrome'
],
launch_in_dev: [
'Chrome'
],
browser_args: {
Chrome: {
mode: 'ci',
args: [
'--disable-gpu',
'--headless',
'--remote-debugging-port=0',
'--window-size=1440,900'
]
}
}
};
If you already checked for the obvious browser settings and it still doesn't work: see if you're setting EMBER_ENV=test.

Asteroid Oauth loginServiceConfiguration: 'google' of undefined

I've followed the 'naive' implementation in the project README: https://github.com/mondora/asteroid-oauth-mixin
The only difference in my code from the example is changing the arrow function to a traditional for the usage of this.
asteroid.ddp.on("added", ({collection, id, fields}: { collection: string; fields: {}, id: string }) => {
if (collection === "meteor_accounts_loginServiceConfiguration") {
asteroid.loginServiceConfiguration = {
...asteroid.loginServiceConfiguration,
[id]: {
_id: id,
...fields
}
};
}
});
});
asteroid.getServiceConfig = function(providerName: string) { // ts file
return this.loginServiceConfiguration[providerName];
}
When I do asteroid.loginWith('google')
index.ts:50 Uncaught TypeError: Cannot read property 'google' of undefined
On the meteor backend I also installed meteor add accounts-base accounts-google because I assume this is a dependency.
What am I missing? Thanks!
I've tried adding DDP.loginServiceConfiguration = {} before the snippet above which resolves the error but creates a new error.
asteroid-oauth-mixin.js:787 Uncaught TypeError: Cannot read property 'clientId' of undefined
at getOauthClientId (asteroid-oauth-mixin.js:787)
at Object.getOptions (asteroid-oauth-mixin.js:720)
at Asteroid.loginWith (asteroid-oauth-mixin.js:104)
at LoginForm../src/routes/accounts/auth/LoginForm.tsx.LoginForm.handleLoginWithGoogle (
Also when I run meteor mongo should db.meteor_accounts_loginServiceConfiguration.find().count() be 0 ?
I needed to meteor add service-configuration and setup my configure-accounts.js and create a google clientId for the application.
This gets me to the point where I have a popup and can choose which user to auth with. Then I receive a new error about target origin mismatch, but I'm going to close this question as resolved.

Cannot read user info - Adal error cannot login

I am trying to implement authentication with ADAL (Inside a react app), so I followed the example from Azure-Samples, and this is my code:
var AuthenticationContext = require('../../node_modules/adal-angular/lib/adal.js');
var adalInstance = new AuthenticationContext({
instance: 'https://login.microsoftonline.com/',
clientId: '9897809e-XXXX-XXXX-XXXX-3e6de068af92',
postLogoutRedirectUri: window.location.origin,
endpoints: {}
});
export function enter() {
adalInstance.login();
var isCallback = adalInstance.isCallback(window.location.hash);
adalInstance.handleWindowCallback();
if (isCallback && !adalInstance.getLoginError()) {
adalInstance.acquireToken(adalInstance.config.clientId, function (error, token) {
if (error || !token) {
console.log('ADAL Error Occurred: ' + error);
return;
}
});
}
var user = adalInstance.getCachedUser();
console.log(user);
}
export function logout() {
adalInstance.logout();
}
So I have the following messages:
ADAL Error Occurred: User login is required
and for user, I get null.
Currently I can go to the microsoft login page (called from the login component), login, and return to the app. I have the sessionStorage set:
Storage { adal.state.login: "73771340-XXXX-XXXX-XXXX-858c9edcba05", adal.nonce.idtoken: "20074445-XXXX-XXXX-XXXX-9f94c9b5cc31", adal.login.error: "", adal.error: "Invalid_state", adal.login.request: "http://localhost:3000/#id_token=eyJ…", adal.error.description: "Invalid_state. state: a2f210a5-e34b…", adal.token.renew.status: "Completed", length: 7 }
What I am doing wrong?
DATA: I am using adal.js library from the adal-angular package version: AdalJS v1.0.13
EDIT:
Now I am using an specific adal.js from here
I changed my code to:
var AuthenticationContext = require('./adal.js');
When I compiled it (using webpack with babel for transpiling es6 code), but gave me an error about logging is not defined, so I added:
var Logging = {
level: 3,
log: function (message) {
console.log(message);
}
}
to the adal library.
And now, I am getting in the browser(firefox, because chromes seems to not show any log I dont know why) console:
Wed, 18 Jan 2017 11:52:51 GMT:1.0.13-VERBOSE: State: d3c2bb0d-XXXX-XXXX-XXXX-e98a460572e2 bundle.js:74558:8
Wed, 18 Jan 2017 11:52:51 GMT:1.0.13-INFO: Returned from redirect url bundle.js:74558:8
Wed, 18 Jan 2017 11:52:51 GMT:1.0.13-INFO: State status:false; Request type:UNKNOWN bundle.js:74558:8
Wed, 18 Jan 2017 11:52:51 GMT:1.0.13-WARNING: User login is required bundle.js:74558:8
ADAL Error Occurred: User login is required bundle.js:74507:10
USER null bundle.js:74513:4
During integrating with PowerBi endpoint, I got a same error. After some research got this result. So the code below does auto login. Replace the method yourLogic to use the token for api request.
import AuthenticationContext from "adal-angular/lib/adal";
window.AuthenticationContext = AuthenticationContext;
let authenticationContext = new window.AuthenticationContext({
instance: "https://login.microsoftonline.com/",
clientId: "XXXXXXX",
postLogoutRedirectUri: window.location.origin,
cacheLocation: "localStorage", // enable this for IE, as sessionStorage does not work for localhost.
}),
resource = "https://analysis.windows.net/powerbi/api",
isCallback = authenticationContext.isCallback(window.location.hash);
authenticationContext.handleWindowCallback();
let user = authenticationContext.getCachedUser(),
token = authenticationContext.getCachedToken(resource),
loginActive = isCallback && user && !token,
renewActive = isCallback && user && !!token;
if (user) {
if (!renewActive) {
authenticationContext.acquireToken(resource, (errorDesc, token, error) => {
if (!error) {
yourLogic(token);
} else {
authenticationContext.error("Error when acquiring token for resource: " + resource, error);
}
});
}
} else {
authenticationContext.login();
}
Sorry for the characters limitation of comment, I write my troubleshooting suggestion as an answer here.
Actually, your code snippet works fine on my side. For troubleshooting and arrow down the issue, you can try the following options.
Currently, it seems that the javascript syntax on browser is not support export,require key words. So you can check the bundled script, whether there is anything wrong about the global variables. You can test your AAD application with plain javascript within adal.js, as the sample you are referring.
You can try to add global variable logging to track all the info during the authentication flow. E.G. add following code in js script.
Logging = {
level: 3,
log: function (message) {
console.log(message);
}
}

Unhandled Promise rejection: push.on is not a function

I am using Ionic 2.
I get this Typescrpt error when trying to set up Push Notifications. I have copied this sample code from a tutorial, so would have expected it to work. I must have something wrong. Any ideas please:
Unhandled Promise rejection: push.on is not a function ; Zone: angular ; Task: Promise.then ; Value:
TypeError: push.on is not a function
push.on('registration', function (data) {
typescript
import { Push } from 'ionic-native';
.
.
pushNotifications(): void {
var push = Push.init({
android: {
vibrate: true,
sound: true,
senderID: "xxxxxxxxxxxxxxxxxxx"
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});
push.on('registration', (data) => {
console.log(data.registrationId);
alert(data.registrationId.toString());
});
push.on('notification', (data) => {
console.log(data);
alert("Hi, Am a push notification");
});
push.on('error', (e) => {
console.log(e.message);
});
}
Make sure to check if 'window.cordova' is available before using the plugin. Are you actually testing on a device or in browser? Cordova is not available within browser.
EDIT
To make sure your code editor knowns what 'window.cordova' is, make sure you installed cordova typings.
npm install typings -g
typings install dt~cordova --save --global

Categories

Resources