Permission denied

Hye all. im new to WSL2 and nixshell. I got a problem with accessing permission. Im really really appreciate if anyone would like to clarify this error.

The error goes:

[nix-shell:/mnt/c/Users/User/projects/developer-exercises/1.basic/0.zome-functions/exercise/tests]$ npm install && npm run build
npm WARN demo-1@0.0.0 No description
npm WARN demo-1@0.0.0 No repository field.

audited 179 packages in 2.219s

41 packages are looking for funding
run npm fund for details

found 1 high severity vulnerability
run npm audit fix to fix them, or npm audit for details

demo-1@0.0.0 build /mnt/c/Users/User/projects/developer-exercises/1.basic/0.zome-functions/exercise/tests
cd … && CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown

Updating crates.io index

warning: spurious network error (2 tries remaining): failed to mmap. Could not write data: Permission denied; class=Os (2)
warning: spurious network error (1 tries remaining): failed to mmap. Could not write data: Permission denied; class=Os (2)
error: failed to get chrono as a dependency of package exercise v0.0.1 (/mnt/c/Users/User/projects/developer-exercises/1.basic/0.zome-functions/exercise/zomes/exercise)
Caused by:
failed to fetch https://github.com/rust-lang/crates.io-index

Caused by:
failed to mmap. Could not write data: Permission denied; class=Os (2)
npm ERR! code ELIFECYCLE
npm ERR! errno 101
npm ERR! demo-1@0.0.0 build: cd .. && CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown
npm ERR! Exit status 101
npm ERR!
npm ERR! Failed at the demo-1@0.0.0 build 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! /home/najidnadri/.npm/_logs/2021-07-17T06_12_47_377Z-debug.log

What does log file says? You can view it as follows:

more /home/najidnadri/.npm/_logs/2021-07-17T06_12_47_377Z-debug.log

It will provide hints.

Add sudo before command. Like

sudo Your-Command-Name-Goes-Here

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki