Closed JordanMartinez closed 4 years ago
Good catch. The shell provides everything except the NPM dependencies — ncc, specifically, which might actually be in Nix and I haven’t checked — so you also need to run npm install.
Ok. Another issue to fix. I get an error when I run sudo npm link
:
[nix-shell:~/Programming/Git Projects/purescript-contrib-governance/updater]$ sudo npm link
sudo npm link
sudo: npm: command not found
Turns out you have to exit nix-shell
and then run npm link
Huh — that’s weird. I’m not exiting the shell and Node is included in the shell, which should also include npm automatically. You don’t have access to npm at all in the shell?
Reproduction from my system:
~/Desktop/governance/updater (main) $ which node
/.../.nvm/versions/node/v12.0.0/bin/node
~/Desktop/governance/updater (main) $ which npm
/.../.nvm/versions/node/v12.0.0/bin/npm
~/Desktop/governance/updater (main) $ nix-shell
[nix-shell:~/.../governance/updater]$ which node
/nix/store/0j4i6dsqq4fvvm7z5zka62vi3xrfgzv6-nodejs-12.15.0/bin/node
[nix-shell:~/.../governance/updater]$ which npm
/nix/store/0j4i6dsqq4fvvm7z5zka62vi3xrfgzv6-nodejs-12.15.0/bin/npm
However, it's also acceptable to just run npm link
outside the shell.
The issue arises when I use both sudo
and npm
in the same command. Running npm link
causes a crash due to permissions issues, which made me run sudo npm link
. However, running that will then output the above error as though npm
doesn't exist when it clearly does.
While following the instructions for compiling the updater tool, I got stuck here:
nix-shell
npm run build
sh: ncc: command not found
:[info] Installation complete. Src Lib All Warnings 0 0 0
Errors 0 0 0
[info] Build succeeded. [info] Bundling first... [info] Bundle succeeded and output file to output/index.js [info] Make module succeeded and output file to output/index.js sh: ncc: command not found npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT npm ERR! contrib-updater@ build:
spago bundle-module --to output/index.js && ncc build --minify --out bin index.js
npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the contrib-updater@ build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?npm ERR! A complete log of this run can be found in: npm ERR! /home/jordan/.npm/_logs/2020-08-27T20_42_15_055Z-debug.log