Syntaxerror: Unexpected Token , in Hawk (fresh npn install) - javascript

I am in the process of learning Nodejs and WebRPC. I am for all intents and purposes, a novice.
I installed the Plivo (http://plivo.com) API for nodejs and when attempting to run it I had an issue with Const which I resolved by running my test file with --harmony appended to the start of the command, after this I have gained the error
Syntaxerror: Unexpected token ,
This error falls on line 506 of
\hawk\lib\server.js
The relevant section of code is;
const artifacts = {
ts: authorization.ts,
nonce: authorization.nonce,
host,
port,
hash: authorization.hash
};
line 506 is host,
I do not see the problem.
At this point, all I am trying to do is initialise the plivo API. I have no other calls to it.
I have deleted the hawk folder and done a fresh npm install hawk, can anyone else suggest anything?
edit:
As of writing the post, I attempted to load hawk directly in a script rather than as a dependency through plivo. It still brings up the same error so it won't be a problem with plivo.
Edit 2.
Seems it was a versioning issue. My system had v0.12 installed. I attempted to update it twice, both times the install went back to v0.12 despite uninstalling it first.
Cleared appdata\roaming\npm and appdata\roaming\npm-cache as well as deleting any remaining node files in "c:\program files" before reinstalling. I now have 8.x installed and the syntax error is no longer showing.
Thanks
Ken

Related

zsh: command not found: sls

I am running a node js application with AWS.
This is server less application therefore when I am trying to install through this
https://www.serverless.com/plugins/serverless-offline
Things are working fine till here.. after that when I am trying to run sls offline I am getting this error.
zsh: command not found: sls
Can anybody help me what I am missing here. Also I have places all the access details of my AWS creads in AWS credentials.

NPM: request to https://registry.npmjs.org/corepack failed, reason: connect EHOSTUNREACH

NPM used to work no problem but now for some reason anything I try to do that involves connecting to the registry times out.
The failure message I get from NPM is request to https://registry.npmjs.org/corepack failed, reason: connect EHOSTUNREACH 2606:4700::6810:1223:443
The command I'm running is npm update -g.
I'm on Arch Linux, and I installed the NPM package from arch. It is version 8.19.2 (the latest on arch).
I tried two DNS, the one I'm using now is Cloudflare (1.1.1.1).
Pinging "registry.npmjs.org" results in From 2600:1700:4630:c000::1 (2600:1700:4630:c000::1) icmp_seq=1 Destination unreachable: Address unreachable
But if I go to registry.npmjs.org in my web browser, I get the expected json result.
Any help is appreciated.
https://askubuntu.com/questions/32298/prefer-a-ipv4-dns-lookups-before-aaaaipv6-lookups/38468#38468
For some reason ipv6 requests are not working on my current network. I "solved" the issue for now by preferring ipv4 using the solution in the link above. Ultimately I'd like to find out why ipv6 is not working on my computer/network but for now this is fine.

Truffle contract deployment stuck

Whenever i use truffle to deploy, my console outputs an empty line and gets stuck
Here is my config :
When i run truffle migrate --network ropsten the console stops and it doesn't output anything.
Any help would be appreciated
UPDATE
Now im getting this error :
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: getaddrinfo ENOTFOUND ropsten.infura.io
So as it turns out, Infura do not have functionality to unlock an account using the private key. I ended up moving my code back to remix.Although you cant work and develop locally with remix, it provides a great interface for deploying smart contracts from your meta mask wallet. No migration scripts required!

Zeit asking me for "mysql2" dependency, but I have it installed

I'm trying to make a project work on zeit hosting. I'm using Node with Express and Sequelize with mysql2.
When I try to run the app in zeit, it give me the following errors:
-------------------------------------------------------
Duration: 425.50 ms Billed Duration: 500 ms Memory Size: 3008 MB Max Memory Used: 96 MB
RequestId: 2923134e-be9b-4223-96c7-dce58b5a0b19 Process exited before completing request
Error: Please install mysql2 package manually
-------------------------------------------------------
I have mysql2 installed on my project, and the app runs perfectly fine in localhost. What could be causing this?
I have tried to add node_modules on the github repo, and also tried to unninstall mysql2 and reinstall it as global, but both didn't work.
I just don't know if this problem is caused by some code error or some mistake related to the way I uploaded the files.
Here's the Github repo, you can check the project running on localhost normally.
https://github.com/vitorlimadev/employee_management_system
This is a known bug with ncc that has a workaround.
let db = new Sequelize({
dialect: 'mysql',
dialectModule: require('mysql2')
});
See this comment: https://github.com/vercel/ncc/issues/345#issuecomment-487404520

Node.js Setup Wizard ended Prematurely on Windows 10 64 bit

I tried to install Node.js Setup for the first time (node-v8.9.1-x64 and node-v9.2.0-x64) on a system running Windows 10 64-bit , but it is giving the dreaded error
Node.js Setup Wizard ended Prematurely
Failed Attempts
Launching .msi from Command Prompt ran as Administrator
Disabling the installation options
Performance Counters
Event Tracing
Online Document Shortcuts
Registry Key Search
No registry keys were found when running the following
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\_V2Providers\{793c9b44-3d6b-4f57-b5d7-4ff80adcf9a2}" /s
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\_V2Providers\{1e2e15d7-3760-470e-8699-b9db5248edd5}" /s
The installation log shows an error status: 1603. [View Installation Log]
Node is not installed
node -v
Output:
'node' is not recognized as an internal or external command, operable program or batch file.
Attempt 3
Tried the following based on Github issue #4329, but theres no output after running this.
msiexec /i node-v8.9.1-x64.msi /qn+ ADDLOCAL=ALL REMOVE=NodePerfCtrSupport,NodeEtwSupport
Any ideas how to solve this problem?

Categories

Resources