Node_modules is not recognized

Asked

Viewed 1,192 times

2

Why does this happen at the Windows 10 prompt? Commands like in filename.js works.

It happens when I try:

node_modules/mocha/bin/mocha

In the environment variables I put:

%USERPROFILE%\AppData\Roaming\npm

I tried with the username, with C:, nothing worked. The mocha module has not been installed overall, it is in another folder node_modules inside the project folder, I also put this path in the PATH and nothing.

How does it work node_modules, global, local installation and how this applies to Windows with environment variables?

  • 1

    Hello, welcome! You can give an example of the code you are using mocha? Usually you do npm install mocha eventually with -save or -save-dev.

  • Hello I discovered the problem needed to put Node node_modules/mocha/bin/mocha, to work, thanks.

  • You had done npm install -g mocha?

  • Yes, the problem is that I was following a tutorial that uses Mac and has some divergences of commands, I went through it several times. On your Mac you don’t need to type Ode before the path (path - node_modules/mocha/bin/mocha).

  • And joined the path in windows PATH?

  • The path was no longer certain, but it only recognized the command with the word "Node" before the node_modules/mocha/bin/mocha command.

Show 1 more comment

1 answer

1

The command is from a class of Node and in class the teacher uses Mac and in class it was only install the mocha and then type this command line, but on the PC that is my case (Windows) he does not accept the command without the word "Node" in front, until I returned to class several times, but the teacher who uses Mac does not type "Node" and on Windows worked that way:

node node_modules/mocha/bin/mocha

Just typing:

node_modules/mocha/bin/mocha

It causes the error "Node_modules is not recognized", which is why I ask for help here in the forum. I replied, because I saw that someone commented and if someone has that mistake here is the answer.

(Edited response because of negative points, I didn’t know I had to write a long answer)

  • Explain better the answer so others can understand better. So short calls negative votes...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.