Ionic platform add android problem. why?


I try to change my code in a new laptop and installed almost all things. But when I try to add the android platfoorm using command

ionic cordova platform add android

the command wait unlimited time without any result or Error . It’s output is

(node:4895) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch platform cordova-android@7.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/t/.npm/_cacache'
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <>
    at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:312:25
    at _rejected (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:797:24)
    at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:823:30
    at Promise.when (/usr/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/cordova/node_modules/q/q.js:808:41)
    at /usr/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/usr/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/usr/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:4895) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4895) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I am using Ubuntu 16.04.
Please advise



I think this is the issue related with permission issue of Ubuntu.
try to run the command as super user.

sudo ionic cordova platform add android