Npm virtualized file systems error

Hi there!

I have nodejs_18 installed on my build. I used npm install to install the modules from one of my projects on GitHub. There were no errors. It said New minor version of npm available! 9.5.1 -> 9.8.1, so I ran npm install -g npm@latest and am getting this error

This is the content of the log it has generated

0 verbose cli /nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/node /run/current-system/sw/bin/npm
1 info using npm@9.5.1
2 info using node@v18.16.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:/home/vageesh/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:setEnvs Completed in 0ms
15 timing config:load Completed in 4ms
16 timing npm:load:configload Completed in 5ms
17 timing npm:load:mkdirpcache Completed in 0ms
18 timing npm:load:mkdirplogs Completed in 0ms
19 verbose title npm install npm@latest
20 verbose argv "install" "--global" "npm@latest"
21 timing npm:load:setTitle Completed in 1ms
22 timing config:load:flatten Completed in 1ms
23 timing npm:load:display Completed in 2ms
24 verbose logfile logs-max:10 dir:/home/vageesh/.npm/_logs/2023-08-06T19_31_53_128Z-
25 verbose logfile /home/vageesh/.npm/_logs/2023-08-06T19_31_53_128Z-debug-0.log
26 timing npm:load:logFile Completed in 3ms
27 timing npm:load:timers Completed in 0ms
28 timing npm:load:configScope Completed in 0ms
29 timing npm:load Completed in 12ms
30 timing config:load:flatten Completed in 0ms
31 silly logfile done cleaning log files
32 http fetch GET 200 15ms (cache hit)
33 timing arborist:ctor Completed in 0ms
34 timing idealTree:init Completed in 4ms
35 http fetch GET 200 6ms (cache hit)
36 timing idealTree:userRequests Completed in 18ms
37 silly idealTree buildDeps
38 silly fetch manifest npm@9.8.1
39 silly placeDep ROOT npm@9.8.1 OK for:  want: 9.8.1
40 timing idealTree:#root Completed in 5ms
41 timing idealTree:node_modules/npm Completed in 0ms
42 timing idealTree:buildDeps Completed in 6ms
43 timing idealTree:fixDepFlags Completed in 1ms
44 timing idealTree Completed in 29ms
45 timing reify:loadTrees Completed in 339ms
46 timing reify:diffTrees Completed in 3ms
47 silly reify mark retired [
47 silly reify   '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/npm',
47 silly reify   '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/npm',
47 silly reify   '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/npx'
47 silly reify ]
48 silly reify moves {
48 silly reify   '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/npm': '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/.npm-wxvEllwD',
48 silly reify   '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/npm': '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/.npm-hEv4GfE3',
48 silly reify   '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/npx': '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/bin/.npx-c3vu8kUo'
48 silly reify }
49 timing reify:rollback:retireShallow Completed in 1ms
50 timing command:install Completed in 384ms
51 verbose stack Error: EROFS: read-only file system, rename '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/npm' -> '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/.npm-wxvEllwD'
52 verbose cwd /home/vageesh/Documents/portfolio
53 verbose Linux 6.1.42
54 verbose node v18.16.1
55 verbose npm  v9.5.1
56 error code EROFS
57 error syscall rename
58 error path /nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/npm
59 error dest /nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/.npm-wxvEllwD
60 error errno -30
61 error rofs EROFS: read-only file system, rename '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/npm' -> '/nix/store/hgi70yhpw8wjaid984bpp0qlchy9iils-nodejs-18.16.1/lib/node_modules/.npm-wxvEllwD'
62 error rofs Often virtualized file systems, or other file systems
62 error rofs that don't support symlinks, give this error.
63 verbose exit -30
64 timing npm Completed in 404ms
65 verbose unfinished npm timer reify 1691350313185
66 verbose unfinished npm timer reify:retireShallow 1691350313527
67 verbose code -30
68 error A complete log of this run can be found in:
68 error     /home/vageesh/.npm/_logs/2023-08-06T19_31_53_128Z-debug-0.log

There is issue with installing other packages globally as well:

Please let me know what I am doing wrong or if there is anything more I have to do.