How do you fix npm not found when npm can't be installed in Replit?

My app was working fine but I suddenly got this error

sh: 1: npm: not found
exit status 127
nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
evaluating file ‘/nix/store/x8dbrija74rnw16hrbw5r5apx9k81giz-nixpkgs-21.11-src/pkgs/top-level/config.nix’
error: undefined variable ‘os’ at…

i tried installing the npm package using the sidebar but am unable to

not sure how to fix!

Could you post a link to your Repl? Posting a link to your Repl would help the community help you with your problem.

2 Likes

https://replit.com/@joeypohie/PainfullyLearningHowToCode#styles/globals.css

I managed to fix it by putting ‘npm run dev’, but it crashed the next day. So I had to open the repl ‘npm run dev’ again, and it worked again o.o and then i refreshed it, and it stopped working again…

Hi @asteria do you have always on turned on?

Yes I do. I turned it off but it’s still not working

I think it’s related to my inability to download npm on the repl? (i’m using the side bar to download it)

Hi @asteria is this question related to the other topic you posted? Replit: Package operation failed while installing npm package - #2 by IanAtReplit

If so I’ll merge the topics to keep the timeline clean.

Yes it is! Changing the replit.nix worked :slight_smile: Thanks so much!