I am trying to install shadow-cljs . This is a ClojureScript compilation tool. People outside of Nix/NixOS community usually install it via npm.
I had a similar experience recently installing Firebase CLI. And I successfully installed it with this NixOS package which is “pre-fixed” as a node package: nodePackages.firebase-tools.
2 - If I try to install it on the terminal the “classic way”, it does not work, since the classic installation kind of violates NixOS architecture (as far as I am concerned):
[pedro@system:~]$ npm -v
6.14.15
[pedro@system:~]$ npm -g install shadow-cljs
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN checkPermissions Missing write access to /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'
npm ERR! }
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/pedro/.npm/_logs/2022-07-28T20_24_44_069Z-debug.log
[pedro@system:~]$ sudo npm -g install shadow-cljs
[sudo] password for pedro:
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN checkPermissions Missing write access to /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! code EROFS
npm ERR! syscall access
npm ERR! path /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, access '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-07-28T20_25_19_965Z-debug.log
Is there a way to solve this? Is there way to use npm as a package manager instead of nix while in NixOS?
[pedro@system:~/projects/balance]$ npm -v
6.14.15
[pedro@system:~/projects/balance]$ npm install shadow-cljs
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN deprecated grpc@1.16.1: This library will not receive further updates other than security fixes. We recommend using @grpc/grpc-js instead.
npm WARN deprecated fsevents@1.2.9: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN checkPermissions Missing write access to /home/pedro/projects/balance/node_modules/@sheet/core
npm WARN @js-joda/timezone@2.2.0 requires a peer of @js-joda/core@^1.11.0 but none is installed. You must install peer dependencies yourself.
npm WARN tallyfor-balance@0.3.0 scripts['server'] should probably be scripts['start'].
npm WARN tallyfor-balance@0.3.0 license should be a valid SPDX license expression
npm ERR! code ENOENT
npm ERR! syscall access
npm ERR! path /home/pedro/projects/balance/node_modules/@sheet/core
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, access '/home/pedro/projects/balance/node_modules/@sheet/core'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pedro/.npm/_logs/2022-07-31T13_25_37_489Z-debug.log