2017-08-06 105 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用戶此命令(如果您允許的話)。