IonicaBizau / git-stats

๐Ÿ€ Local git statistics including GitHub-like contributions calendars.
MIT License
6.42k stars 183 forks source link

Ubuntu 20.04.02: install error #169

Closed somera closed 3 years ago

somera commented 3 years ago

Logged in as root and I get this error:

[Sa Apr 03][22:44:09][root]@[nuc-mini-celeron]:[~]# npm i -g git-stats
/usr/local/bin/git-stats -> /usr/local/lib/node_modules/git-stats/bin/git-stats

> git-stats@2.10.13 postinstall /usr/local/lib/node_modules/git-stats
> node scripts/migration/2.0.0.js

error EACCES: permission denied, open '/root/.git-stats'
fs.js:114
    throw err;
    ^

Error: EACCES: permission denied, open '/root/.git-stats'
    at Object.openSync (fs.js:443:3)
    at Object.writeFileSync (fs.js:1194:35)
    at wJson (/usr/local/lib/node_modules/git-stats/node_modules/w-json/lib/index.js:42:69)
    at migrate (/usr/local/lib/node_modules/git-stats/scripts/migration/2.0.0.js:37:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-stats/scripts/migration/2.0.0.js:40:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/git-stats/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! git-stats@2.10.13 postinstall: `node scripts/migration/2.0.0.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the git-stats@2.10.13 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-03T20_44_36_171Z-debug.log
Ryuno-Ki commented 3 years ago

What are the permissions for that directory?

ls -Al /root/.git-stats
somera commented 3 years ago

Isn't there

[~]# ls -Al /root/.git-stats
ls: cannot access '/root/.git-stats': No such file or directory

And

[~]# ls -al
total 72
drwx------  9 root root  4096 Apr  3 22:44 .
drwxr-xr-x 21 root root  4096 Mรคr 12 21:39 ..
-rw-------  1 root root  6348 Apr  7 16:08 .bash_history
-rw-r--r--  1 root root  3336 Mรคr 12 22:42 .bashrc
drwxr-xr-x  3 root root  4096 Mรคr 17 01:14 .cache
drwxr-xr-x  4 root root  4096 Apr  3 22:36 .config
drwxr-xr-x  3 root root  4096 Mรคr 12 21:12 .local
drwxr-xr-x  5 root root  4096 Apr  7 20:17 .npm
Ryuno-Ki commented 3 years ago

ls -al only shows the local directory. (-a includes . and .., whereas -A does not) The script fails to open a file in /root/.

What's the output of ls -Al /root/? (Should not contain sensible entries, I think).

somera commented 3 years ago

Sorry, my mistake.

This

   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                                               โ”‚
   โ”‚      New major version of npm available! 6.14.4 โ†’ 7.8.0       โ”‚
   โ”‚   Changelog: https://github.com/npm/cli/releases/tag/v7.8.0   โ”‚
   โ”‚               Run npm install -g npm to update!               โ”‚
   โ”‚                                                               โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

was the problem. After npm update the installation works.

somera commented 3 years ago

And there the answer on your question:

[~]# ls -Al /root/
total 68
-rw------- 1 root root  6694 Apr  7 20:33 .bash_history
-rw-r--r-- 1 root root  3336 Mรคr 12 22:42 .bashrc
drwxr-xr-x 3 root root  4096 Mรคr 17 01:14 .cache
drwxr-xr-x 4 root root  4096 Apr  3 22:36 .config
-rw-r--r-- 1 root root    19 Apr  7 20:32 .git-stats
drwxr-xr-x 3 root root  4096 Mรคr 12 21:12 .local
drwxr-xr-x 5 root root  4096 Apr  7 20:27 .npm
-rw-r--r-- 1 root root    27 Apr  3 22:44 package-lock.json
-rw-r--r-- 1 root root   161 Dez  5  2019 .profile
drwxr-xr-x 2 root root  4096 Mรคr 28 22:21 .rpmdb
drwxr-xr-x 3 root root  4096 Mรคr 12 21:03 snap
drwx------ 2 root root  4096 Mรคr 12 21:03 .ssh
-rw------- 1 root root 12985 Apr  1 15:04 .viminfo

But after the successful installation.

Ryuno-Ki commented 3 years ago

Glad that we could find a solution!

High five to a fellow Vim user :pray: