I can't install npm 'ejs'

I can’t install ‘ejs’ even though I had installed mongoose , body-parser and express.
I tried the steps below :
1 . I made sure the directory was correct .
2. tried to install as admin from ‘cmd’ .
3. I tried ‘npm i ejs --save’.
4. install the node-module after I deleted it.

note: I installed ‘ejs’ before in another project directory.

Try powershell. I heard that powershell might perform better.

Do you mean this command ‘npm add node-powershell’ in cmd?

Hey there @HaithamCa,

What @razzakammar_nano referring was the Windows Powershell. Here’s an article about it:

Anyways, the first thing you might want to do is to use this command:

npm cache clean

If that doesn’t work, it might be worth re-installing node. If you have a version that is lower then 12.18.2, you might want to update it.

You might also want to check the complete log to look at what’s happening.

Hope this helps.

Ok, but now i am trying to clean a cache but it doesn’t delete and gives me the message belowScreenshot (82)

That’s the problem, you have npm 5. Then newest npm is 6, so you might want to update your NodeJS too. You can check your Node and npm versions using node -v and npm -v respectively. As I said before if your Node version is lower than 12.18.2, update it.

Now after node updated successfully, it can’t find a directory

  • is it nvm-windows rather than nvm?
  • have you read the FAQ for common issues, do any of those match yours? See https://github.com/coreybutler/nvm-windows/wiki/Common-Issues
  • did you install Node before installing NVM? If so you need to carefully remove the first version
  • the path you were trying to install EJS into has spaces in (“web development”), this may cause issues
  • side issue, as you’re stuck on upgrading Node, but am I correct in thinking you have two hard drives (C:\ and E:), and that the project is on E:?

Node is fine on Windows, but there seem to be a lot more hoops to jump through to deal with Windows security and a lot more gotchas than there are on UNIX systems (Linux/OSX). IMO it’s much easier to use WSL for development so that you’re using Linux, rather than the main system, but YMMV. I also actively avoid using Windows, so someone who does development work using that OS is likely to be able to provide more specific help

I installed node and npm again in a latest version . but the same issue.
now I am trying to install linux may that help me.
Thanks a lot.

Do you mean you’re enabling WSL and just installing the Linux subsystem you want from the windows store? Or are you literally installing a new OS?

I installing a new one.

You literally just need to turn it on in Windows 10 then go to the windows store and grab which Linux you want (normally just Ubuntu is easiest), takes like 5-10 minutes if that. You don’t need to install a new OS

Do you mean virtual machine ?

No, Windows has an option to install Linux (command line only, but that’s all you need) as a subsystem. You don’t need a VM or dual boot or whatever

1 Like

If you sign up for the Windows Insiders program you can download & use WSL2 which is an actual Linux kernel (I advise doing this). Otherwise it’s WSL1, which is just a compatibility layer. Either should work fine for what you want to do, may take some fiddling with to get used to accessing the right file paths for your stuff (particularly if you have two HDs)

No need for an insider Win10: since the May update, WSL2 is part of mainline now.

Ooh, nice, getting tempted to reinstall Windows on my laptop

I installed wsl but I can’t install wsl 2. Now I am struggling with wsl and I don’t know what I should be doing then?.
Many of the commands i make give me “command not find”
like “sudo npm -v”, “sudo npm i ejs” etc…

It’s not installed, you need to install what you’re using on the Linux system. It’s basically a complete system, you install and run from there

Thanks a lot . but I solve the problem it’s just
“npm i ejs --force”