ericyd / gdrive-copy

Web app to copy a Google Drive folder
https://script.google.com/macros/s/AKfycbxbGNGajrxv-HbX2sVY2OTu7yj9VvxlOMOeQblZFuq7rYm7uyo/exec
MIT License
1.58k stars 341 forks source link

Login Error in ubuntu #162

Open b06357-redlands opened 4 years ago

b06357-redlands commented 4 years ago

I am trying to host on my linux system

ubuntu@ip-172-31-43-83:~/gdrive-copy$ npm run clasp:login

> google-drive-copy-folder@6.1.0 clasp:login /home/ubuntu/gdrive-copy
> clasp login

Logging in globally...
🔑 Authorize clasp by visiting this url:
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.deployments%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.projects%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.webapp.deploy%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fservice.management%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Flogging.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&client_id=1072944905499-vm2v2i5dvn0a0d2o4ca36i1vge8cvbn0.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A42920

(node:13988) UnhandledPromiseRejectionWarning: Error: Exited with code 3
    at ChildProcess.cp.once.code (/home/ubuntu/gdrive-copy/node_modules/opn/index.js:84:13)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Socket.stream.socket.on (internal/child_process.js:336:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:561:12)
(node:13988) 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:13988) [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.
^Cubuntu@ip-172-31-43-83:~/gdrive-copy$ npm run clasp:login

> google-drive-copy-folder@6.1.0 clasp:login /home/ubuntu/gdrive-copy
> clasp login

Logging in globally...
🔑 Authorize clasp by visiting this url:
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.deployments%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.projects%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.webapp.deploy%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fservice.management%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Flogging.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&client_id=1072944905499-vm2v2i5dvn0a0d2o4ca36i1vge8cvbn0.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A36138

(node:14118) UnhandledPromiseRejectionWarning: Error: Exited with code 3
    at ChildProcess.cp.once.code (/home/ubuntu/gdrive-copy/node_modules/opn/index.js:84:13)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Socket.stream.socket.on (internal/child_process.js:336:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:561:12)
(node:14118) 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:14118) [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.
ericyd commented 4 years ago

What version of node are you using?

You can try using clasp globally instead of the local version. Try

npm i -g clasp
clasp login

And see if that works?

b06357-redlands commented 4 years ago

Node version is:

ubuntu@ip-172-31-38-16:~$ node -v
v8.17.0
ubuntu@ip-172-31-38-16:~$ npm -v
6.13.4

I installed node using the following command:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

Anyways, after running the above commands as root I get this:

root@ip-172-31-38-16:/home/ubuntu/gdrive-copy# npm i -g clasp

> clasp@1.0.0 postinstall /usr/lib/node_modules/clasp
> node .

Installing @google/clasp...
Install failed. Must run with sudo.
+ clasp@1.0.0
updated 1 package in 0.915s

root@ip-172-31-38-16:/home/ubuntu/gdrive-copy# sudo npm i -g clasp

> clasp@1.0.0 postinstall /usr/lib/node_modules/clasp
> node .

Installing @google/clasp...
Install failed. Must run with sudo.
+ clasp@1.0.0
updated 1 package in 0.921s
root@ip-172-31-38-16:/home/ubuntu/gdrive-copy#

and when I run using user ubuntu, I get this:

ubuntu@ip-172-31-38-16:~/gdrive-copy$ npm i -g clasp
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/clasp
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules/clasp
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/clasp'
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules/clasp'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules/clasp\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules/clasp' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2020-07-04T17_21_44_145Z-debug.log
ubuntu@ip-172-31-38-16:~/gdrive-copy$
ericyd commented 4 years ago

I can't assist with debugging why clasp won't install on your machine, that is completely outside the realm of this application.