Search code examples
node.jsazureazure-cloud-shell

Node.js RESTful API on Azure


I'm trying to take my first steps in node.js and I've been following this tutorial: https://learn.microsoft.com/en-us/azure/app-service-api/app-service-api-nodejs-api-app When I'm typing npm install -g yo to the cloud shell in azure I get this error:

npm ERR! Linux 4.4.0-83-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yo"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/shiran_dror/app-service-api-node-contact-list/npm-debug.log

How do I use the shell as root/Administrator?


Solution

  • You're supposed to install Swaggerize on your local machine, not in the Cloud Shell.

    Install Swaggerize on your local machine. Swaggerize is a tool that generates Node.js code for your REST API from a Swagger definition.

    When done developing locally, push to App Service with git (section "Deploy the API with Git" from the docs).