Missing ; before statement (Jira Addon - oAuth)












0














I get the error:




[WARNING] File encoding has not been set, using platform encoding windows-1252, i.e. build is platform dependent!



[INFO] Compiling javascript using YUI



[ERROR] missing ; before statement let privateKeyData = fs.readFileSync('location','utf-8');




As shown I have put the ; before let. I don't understand the error. I am creating an add-on for Jira. I started the JS file via cmd and it worked. However when I want to package the project I get that error. Please help.



jQuery(function($) {
var initmyConfluenceMacro = function() {
$(".myConfluenceMacro").each(function() {
const request = require('request');
const fs = require('fs');
let privateKeyData = fs.readFileSync('filelocation', 'utf-8');
const oauth = {
consumer_key: 'mykey',
consumer_secret: privatkey,
token: 'mytoken',
token_secret: 'tokensecret',
signature_method: 'signaturemethod'
};

request.get({
url: 'thelink',
oauth: oauth,
qs: null,
json: true
}, function(e, r, user) {
console.log(user)
});

var html = "output";
$(this).html(html);
});
};

$(document).ready(function() {
initmyConfluenceMacro();
});
});









share|improve this question




















  • 1




    Your code is fine. Maybe it's somewhere else or you just paste code wrong?
    – Justinas
    Nov 12 at 15:49










  • Pf I don't get it. Can it be that it can't package the node_modules with it? I run the same code in cmd and it works :S It shouldn't be somewhere else because I only call it in my main and that's it.
    – TeslaX
    Nov 12 at 15:51






  • 1




    You're compiling with YUI, it looks like, and YUI has not been maintained in a really long time (over 4 years). The parser it uses has many problems.
    – Pointy
    Nov 12 at 16:10










  • @Justinas When I run it with cmd it works fine. Can the problem be that I want to read a file from my pc, but I want to put the js file in a jar. This is another question, but can you maybe point me, on how to read the file / the private key from my jar to js? I put the private key with my js together in the resources folder. (And this is a maven project) Thank you very much!
    – TeslaX
    Nov 16 at 13:04
















0














I get the error:




[WARNING] File encoding has not been set, using platform encoding windows-1252, i.e. build is platform dependent!



[INFO] Compiling javascript using YUI



[ERROR] missing ; before statement let privateKeyData = fs.readFileSync('location','utf-8');




As shown I have put the ; before let. I don't understand the error. I am creating an add-on for Jira. I started the JS file via cmd and it worked. However when I want to package the project I get that error. Please help.



jQuery(function($) {
var initmyConfluenceMacro = function() {
$(".myConfluenceMacro").each(function() {
const request = require('request');
const fs = require('fs');
let privateKeyData = fs.readFileSync('filelocation', 'utf-8');
const oauth = {
consumer_key: 'mykey',
consumer_secret: privatkey,
token: 'mytoken',
token_secret: 'tokensecret',
signature_method: 'signaturemethod'
};

request.get({
url: 'thelink',
oauth: oauth,
qs: null,
json: true
}, function(e, r, user) {
console.log(user)
});

var html = "output";
$(this).html(html);
});
};

$(document).ready(function() {
initmyConfluenceMacro();
});
});









share|improve this question




















  • 1




    Your code is fine. Maybe it's somewhere else or you just paste code wrong?
    – Justinas
    Nov 12 at 15:49










  • Pf I don't get it. Can it be that it can't package the node_modules with it? I run the same code in cmd and it works :S It shouldn't be somewhere else because I only call it in my main and that's it.
    – TeslaX
    Nov 12 at 15:51






  • 1




    You're compiling with YUI, it looks like, and YUI has not been maintained in a really long time (over 4 years). The parser it uses has many problems.
    – Pointy
    Nov 12 at 16:10










  • @Justinas When I run it with cmd it works fine. Can the problem be that I want to read a file from my pc, but I want to put the js file in a jar. This is another question, but can you maybe point me, on how to read the file / the private key from my jar to js? I put the private key with my js together in the resources folder. (And this is a maven project) Thank you very much!
    – TeslaX
    Nov 16 at 13:04














0












0








0







I get the error:




[WARNING] File encoding has not been set, using platform encoding windows-1252, i.e. build is platform dependent!



[INFO] Compiling javascript using YUI



[ERROR] missing ; before statement let privateKeyData = fs.readFileSync('location','utf-8');




As shown I have put the ; before let. I don't understand the error. I am creating an add-on for Jira. I started the JS file via cmd and it worked. However when I want to package the project I get that error. Please help.



jQuery(function($) {
var initmyConfluenceMacro = function() {
$(".myConfluenceMacro").each(function() {
const request = require('request');
const fs = require('fs');
let privateKeyData = fs.readFileSync('filelocation', 'utf-8');
const oauth = {
consumer_key: 'mykey',
consumer_secret: privatkey,
token: 'mytoken',
token_secret: 'tokensecret',
signature_method: 'signaturemethod'
};

request.get({
url: 'thelink',
oauth: oauth,
qs: null,
json: true
}, function(e, r, user) {
console.log(user)
});

var html = "output";
$(this).html(html);
});
};

$(document).ready(function() {
initmyConfluenceMacro();
});
});









share|improve this question















I get the error:




[WARNING] File encoding has not been set, using platform encoding windows-1252, i.e. build is platform dependent!



[INFO] Compiling javascript using YUI



[ERROR] missing ; before statement let privateKeyData = fs.readFileSync('location','utf-8');




As shown I have put the ; before let. I don't understand the error. I am creating an add-on for Jira. I started the JS file via cmd and it worked. However when I want to package the project I get that error. Please help.



jQuery(function($) {
var initmyConfluenceMacro = function() {
$(".myConfluenceMacro").each(function() {
const request = require('request');
const fs = require('fs');
let privateKeyData = fs.readFileSync('filelocation', 'utf-8');
const oauth = {
consumer_key: 'mykey',
consumer_secret: privatkey,
token: 'mytoken',
token_secret: 'tokensecret',
signature_method: 'signaturemethod'
};

request.get({
url: 'thelink',
oauth: oauth,
qs: null,
json: true
}, function(e, r, user) {
console.log(user)
});

var html = "output";
$(this).html(html);
});
};

$(document).ready(function() {
initmyConfluenceMacro();
});
});






javascript jquery node.js oauth jira






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 15:52

























asked Nov 12 at 15:45









TeslaX

449




449








  • 1




    Your code is fine. Maybe it's somewhere else or you just paste code wrong?
    – Justinas
    Nov 12 at 15:49










  • Pf I don't get it. Can it be that it can't package the node_modules with it? I run the same code in cmd and it works :S It shouldn't be somewhere else because I only call it in my main and that's it.
    – TeslaX
    Nov 12 at 15:51






  • 1




    You're compiling with YUI, it looks like, and YUI has not been maintained in a really long time (over 4 years). The parser it uses has many problems.
    – Pointy
    Nov 12 at 16:10










  • @Justinas When I run it with cmd it works fine. Can the problem be that I want to read a file from my pc, but I want to put the js file in a jar. This is another question, but can you maybe point me, on how to read the file / the private key from my jar to js? I put the private key with my js together in the resources folder. (And this is a maven project) Thank you very much!
    – TeslaX
    Nov 16 at 13:04














  • 1




    Your code is fine. Maybe it's somewhere else or you just paste code wrong?
    – Justinas
    Nov 12 at 15:49










  • Pf I don't get it. Can it be that it can't package the node_modules with it? I run the same code in cmd and it works :S It shouldn't be somewhere else because I only call it in my main and that's it.
    – TeslaX
    Nov 12 at 15:51






  • 1




    You're compiling with YUI, it looks like, and YUI has not been maintained in a really long time (over 4 years). The parser it uses has many problems.
    – Pointy
    Nov 12 at 16:10










  • @Justinas When I run it with cmd it works fine. Can the problem be that I want to read a file from my pc, but I want to put the js file in a jar. This is another question, but can you maybe point me, on how to read the file / the private key from my jar to js? I put the private key with my js together in the resources folder. (And this is a maven project) Thank you very much!
    – TeslaX
    Nov 16 at 13:04








1




1




Your code is fine. Maybe it's somewhere else or you just paste code wrong?
– Justinas
Nov 12 at 15:49




Your code is fine. Maybe it's somewhere else or you just paste code wrong?
– Justinas
Nov 12 at 15:49












Pf I don't get it. Can it be that it can't package the node_modules with it? I run the same code in cmd and it works :S It shouldn't be somewhere else because I only call it in my main and that's it.
– TeslaX
Nov 12 at 15:51




Pf I don't get it. Can it be that it can't package the node_modules with it? I run the same code in cmd and it works :S It shouldn't be somewhere else because I only call it in my main and that's it.
– TeslaX
Nov 12 at 15:51




1




1




You're compiling with YUI, it looks like, and YUI has not been maintained in a really long time (over 4 years). The parser it uses has many problems.
– Pointy
Nov 12 at 16:10




You're compiling with YUI, it looks like, and YUI has not been maintained in a really long time (over 4 years). The parser it uses has many problems.
– Pointy
Nov 12 at 16:10












@Justinas When I run it with cmd it works fine. Can the problem be that I want to read a file from my pc, but I want to put the js file in a jar. This is another question, but can you maybe point me, on how to read the file / the private key from my jar to js? I put the private key with my js together in the resources folder. (And this is a maven project) Thank you very much!
– TeslaX
Nov 16 at 13:04




@Justinas When I run it with cmd it works fine. Can the problem be that I want to read a file from my pc, but I want to put the js file in a jar. This is another question, but can you maybe point me, on how to read the file / the private key from my jar to js? I put the private key with my js together in the resources folder. (And this is a maven project) Thank you very much!
– TeslaX
Nov 16 at 13:04












1 Answer
1






active

oldest

votes


















0














The problem for the error is




const fs = require('fs');




fs is for (as on their page) security reasons removed from Atlassian and cannot be used. My workaround was to use the velocity template, in order to import the file, and then to parse it to the js file.



I hope this helps. If someone has other ideas please let me know.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265563%2fmissing-before-statement-jira-addon-oauth%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The problem for the error is




    const fs = require('fs');




    fs is for (as on their page) security reasons removed from Atlassian and cannot be used. My workaround was to use the velocity template, in order to import the file, and then to parse it to the js file.



    I hope this helps. If someone has other ideas please let me know.






    share|improve this answer


























      0














      The problem for the error is




      const fs = require('fs');




      fs is for (as on their page) security reasons removed from Atlassian and cannot be used. My workaround was to use the velocity template, in order to import the file, and then to parse it to the js file.



      I hope this helps. If someone has other ideas please let me know.






      share|improve this answer
























        0












        0








        0






        The problem for the error is




        const fs = require('fs');




        fs is for (as on their page) security reasons removed from Atlassian and cannot be used. My workaround was to use the velocity template, in order to import the file, and then to parse it to the js file.



        I hope this helps. If someone has other ideas please let me know.






        share|improve this answer












        The problem for the error is




        const fs = require('fs');




        fs is for (as on their page) security reasons removed from Atlassian and cannot be used. My workaround was to use the velocity template, in order to import the file, and then to parse it to the js file.



        I hope this helps. If someone has other ideas please let me know.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 at 17:12









        TeslaX

        449




        449






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265563%2fmissing-before-statement-jira-addon-oauth%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python