2017-08-06 106 views
1

我试图采取的Node.js我的第一个步骤,我一直在关注这个教程的RESTful API错误:的Node.js在Azure上

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 

如何以root用户身份使用shell?

回答

2

您应该在本地机器上安装Swaggerize,而不是在云端Shell中。

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

当完成本地开发,推到应用服务与GIT(节“部署使用Git的API”从文档)。

0

看来你的用户没有权限安装在/usr/local/lib/node_modules。尝试删除-g选项以在本地安装。

npm install命令之前使用sudo命令切换到root用户此命令(如果您允许的话)。