解決方案有兩種

1. sudo npm install -g –unsafe-perm=true –allow-root

2. Creating package.json using npm init solved my issue.