How to run Angular 2 apps with Node on Ubuntu?












0















I am trying to install the Angular CLI on Ubnutu 17.04 with via



sudo npm install -g @angular/cli


However it generates the following warnings:



    npm WARN gentlyRm not removing /usr/local/bin/ng as it wasn't installed by /usr/local/lib/node_modules/@angular/cli
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})


and once completed, although the ng executable is in my path, if I try to run any command (e.g. npm serve) I am given the following:



    /usr/local/lib/node_modules/@angular/cli/models/config/config.js:17
constructor(_configPath, schema, configJson, fallbacks = ) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)


It appears to have (attempted?) to install Angular CLI 1.3.2 but the command ng --version doesn't even run. (Produces the error above). As a result I cannot run npm start for Angular 2 apps that I am building.



My npm version is 5.3.0, nodejs version is v4.7.2. I have tried many times now to get this to work and I'm starting to think that maybe there's a bug in npm or angular CLI because I've been successful at installing the Angular CLI on both Mac, Windows and ArchLinux on the command line. How can I get npm to run angular apps on Ubuntu?










share|improve this question



























    0















    I am trying to install the Angular CLI on Ubnutu 17.04 with via



    sudo npm install -g @angular/cli


    However it generates the following warnings:



        npm WARN gentlyRm not removing /usr/local/bin/ng as it wasn't installed by /usr/local/lib/node_modules/@angular/cli
    /usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})


    and once completed, although the ng executable is in my path, if I try to run any command (e.g. npm serve) I am given the following:



        /usr/local/lib/node_modules/@angular/cli/models/config/config.js:17
    constructor(_configPath, schema, configJson, fallbacks = ) {
    ^
    SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)


    It appears to have (attempted?) to install Angular CLI 1.3.2 but the command ng --version doesn't even run. (Produces the error above). As a result I cannot run npm start for Angular 2 apps that I am building.



    My npm version is 5.3.0, nodejs version is v4.7.2. I have tried many times now to get this to work and I'm starting to think that maybe there's a bug in npm or angular CLI because I've been successful at installing the Angular CLI on both Mac, Windows and ArchLinux on the command line. How can I get npm to run angular apps on Ubuntu?










    share|improve this question

























      0












      0








      0


      1






      I am trying to install the Angular CLI on Ubnutu 17.04 with via



      sudo npm install -g @angular/cli


      However it generates the following warnings:



          npm WARN gentlyRm not removing /usr/local/bin/ng as it wasn't installed by /usr/local/lib/node_modules/@angular/cli
      /usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
      npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents):
      npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})


      and once completed, although the ng executable is in my path, if I try to run any command (e.g. npm serve) I am given the following:



          /usr/local/lib/node_modules/@angular/cli/models/config/config.js:17
      constructor(_configPath, schema, configJson, fallbacks = ) {
      ^
      SyntaxError: Unexpected token =
      at exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:373:25)
      at Object.Module._extensions..js (module.js:416:10)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Module.require (module.js:353:17)
      at require (internal/module.js:12:17)
      at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)
      at Module._compile (module.js:409:26)
      at Object.Module._extensions..js (module.js:416:10)


      It appears to have (attempted?) to install Angular CLI 1.3.2 but the command ng --version doesn't even run. (Produces the error above). As a result I cannot run npm start for Angular 2 apps that I am building.



      My npm version is 5.3.0, nodejs version is v4.7.2. I have tried many times now to get this to work and I'm starting to think that maybe there's a bug in npm or angular CLI because I've been successful at installing the Angular CLI on both Mac, Windows and ArchLinux on the command line. How can I get npm to run angular apps on Ubuntu?










      share|improve this question














      I am trying to install the Angular CLI on Ubnutu 17.04 with via



      sudo npm install -g @angular/cli


      However it generates the following warnings:



          npm WARN gentlyRm not removing /usr/local/bin/ng as it wasn't installed by /usr/local/lib/node_modules/@angular/cli
      /usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
      npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents):
      npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})


      and once completed, although the ng executable is in my path, if I try to run any command (e.g. npm serve) I am given the following:



          /usr/local/lib/node_modules/@angular/cli/models/config/config.js:17
      constructor(_configPath, schema, configJson, fallbacks = ) {
      ^
      SyntaxError: Unexpected token =
      at exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:373:25)
      at Object.Module._extensions..js (module.js:416:10)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Module.require (module.js:353:17)
      at require (internal/module.js:12:17)
      at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)
      at Module._compile (module.js:409:26)
      at Object.Module._extensions..js (module.js:416:10)


      It appears to have (attempted?) to install Angular CLI 1.3.2 but the command ng --version doesn't even run. (Produces the error above). As a result I cannot run npm start for Angular 2 apps that I am building.



      My npm version is 5.3.0, nodejs version is v4.7.2. I have tried many times now to get this to work and I'm starting to think that maybe there's a bug in npm or angular CLI because I've been successful at installing the Angular CLI on both Mac, Windows and ArchLinux on the command line. How can I get npm to run angular apps on Ubuntu?







      npm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 26 '17 at 1:08









      Jon DeatonJon Deaton

      1014




      1014






















          2 Answers
          2






          active

          oldest

          votes


















          1














          try using



          sudo su


          check the version of node and npm




          Verify that you are running at least node 6.9.x and npm 3.x.x by
          running node -v and npm -v in a terminal/console window. Older
          versions produce errors, but newer versions are fine.




          then use



          npm install -g @angular/cli


          create new folder



          ng new my-dream-app


          change the current directory to the newly created folder



          cd my-dream-app


          start the angular server with



          ng serve


          I recommend you to use 16.04 lts ubuntu verion






          share|improve this answer































            0














            That version (1.3.x) for Angular CLI needs Node 6.9 or higher (read from @angular/cli from npm page here.



            I suggest you to install node version manager (NVM) in order to manage different node versions, docs here



            After getting the proper node version installed, try again to install angular cli and it should work fine.





            share























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              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%2faskubuntu.com%2fquestions%2f949885%2fhow-to-run-angular-2-apps-with-node-on-ubuntu%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              try using



              sudo su


              check the version of node and npm




              Verify that you are running at least node 6.9.x and npm 3.x.x by
              running node -v and npm -v in a terminal/console window. Older
              versions produce errors, but newer versions are fine.




              then use



              npm install -g @angular/cli


              create new folder



              ng new my-dream-app


              change the current directory to the newly created folder



              cd my-dream-app


              start the angular server with



              ng serve


              I recommend you to use 16.04 lts ubuntu verion






              share|improve this answer




























                1














                try using



                sudo su


                check the version of node and npm




                Verify that you are running at least node 6.9.x and npm 3.x.x by
                running node -v and npm -v in a terminal/console window. Older
                versions produce errors, but newer versions are fine.




                then use



                npm install -g @angular/cli


                create new folder



                ng new my-dream-app


                change the current directory to the newly created folder



                cd my-dream-app


                start the angular server with



                ng serve


                I recommend you to use 16.04 lts ubuntu verion






                share|improve this answer


























                  1












                  1








                  1







                  try using



                  sudo su


                  check the version of node and npm




                  Verify that you are running at least node 6.9.x and npm 3.x.x by
                  running node -v and npm -v in a terminal/console window. Older
                  versions produce errors, but newer versions are fine.




                  then use



                  npm install -g @angular/cli


                  create new folder



                  ng new my-dream-app


                  change the current directory to the newly created folder



                  cd my-dream-app


                  start the angular server with



                  ng serve


                  I recommend you to use 16.04 lts ubuntu verion






                  share|improve this answer













                  try using



                  sudo su


                  check the version of node and npm




                  Verify that you are running at least node 6.9.x and npm 3.x.x by
                  running node -v and npm -v in a terminal/console window. Older
                  versions produce errors, but newer versions are fine.




                  then use



                  npm install -g @angular/cli


                  create new folder



                  ng new my-dream-app


                  change the current directory to the newly created folder



                  cd my-dream-app


                  start the angular server with



                  ng serve


                  I recommend you to use 16.04 lts ubuntu verion







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 7 '18 at 5:06









                  Koustubh G.Koustubh G.

                  134




                  134

























                      0














                      That version (1.3.x) for Angular CLI needs Node 6.9 or higher (read from @angular/cli from npm page here.



                      I suggest you to install node version manager (NVM) in order to manage different node versions, docs here



                      After getting the proper node version installed, try again to install angular cli and it should work fine.





                      share




























                        0














                        That version (1.3.x) for Angular CLI needs Node 6.9 or higher (read from @angular/cli from npm page here.



                        I suggest you to install node version manager (NVM) in order to manage different node versions, docs here



                        After getting the proper node version installed, try again to install angular cli and it should work fine.





                        share


























                          0












                          0








                          0







                          That version (1.3.x) for Angular CLI needs Node 6.9 or higher (read from @angular/cli from npm page here.



                          I suggest you to install node version manager (NVM) in order to manage different node versions, docs here



                          After getting the proper node version installed, try again to install angular cli and it should work fine.





                          share













                          That version (1.3.x) for Angular CLI needs Node 6.9 or higher (read from @angular/cli from npm page here.



                          I suggest you to install node version manager (NVM) in order to manage different node versions, docs here



                          After getting the proper node version installed, try again to install angular cli and it should work fine.






                          share











                          share


                          share










                          answered 3 mins ago









                          mscalzottomscalzotto

                          45445




                          45445






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • 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%2faskubuntu.com%2fquestions%2f949885%2fhow-to-run-angular-2-apps-with-node-on-ubuntu%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

                              GameSpot

                              connect to host localhost port 22: Connection refused

                              Getting a Wifi WPA2 wifi connection