npm or yarn command error – cli.js not found

While working on a project, I needed to use npm packages and I received a strange error while trying to use them. I ended up with the same error for yarn commands. Now, I had used npm some time back and did not have any issues.

Below is the error I ended up with each time I tried a npm or a yarn command.

internal/modules/cjs/loader.js:883  

throw err;

Error: Cannot find module ‘C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js’

Solutions I tried and did not work for me:

  1. Reinstall npm.
  2. Repair npm
  3. Update my .npmrc file
  4. Restart the system! – that’s what the IT service center asks you to do first thing when you contact them….

What solved the problem?

So, obviously I tried and find the file mentioned in the error in my node.js folder. I obviously found it and banged my head on the wall!

Finally, I tried to trace the file by exact path when I noticed that the following part was extra in there –

node_modules\npm\bin

The correct path should have been “C:\Program Files\nodejs\node_modules\npm\bin\ npm-cli.js”

And that’s wen I went back and looked at my environment variables and found following culprit!!

npm path environment entry

All I had to do was delete this entry, restart my command line and BINGO!

Finally, the moral of the story is – the system variable for npm should be as below:

npm path environment entry

Now, The question is how did that erroneous entry landed in my system variables? There could be multiple reasons for it like:

  1. I manually added it and obviously do not remember!
  2. At some point of time, my system some how had multiple versions of node.js
  3. It got corrupted while updating the node.js versions.

Hope this helps someone in need. Till then,

Happy Coding 😊

Quality Center QC Error : ACCESS VIOLATION AT ADDRESS IN MODULE abc.ocx . Read of address

Some times, we get access violation error at some address on some of the functions in quality center.

 99% of cases when i got this error was when i tried copy and paste in quality center. The copy paste would work fine for some time and suddenly, it would stop working.

The solution i have found to resolve it is as below:-

I recommend that our users follow this procedure to make sure that IE has a clean startup.

1. Close all instances of IE and all instances of Windows Explorer.
2. Open task manager and kill the explorer.exe process (don’t close task manager at this point….otherwise use ctrl-alt-del to get back to Task Manager). Click File –> New Task (run)  –>  type explorer.exe and hit enter.
3. Open a new browser and try to access Quality Center again.

IE and Windows explorer and the desktop explorer.exe process are intertwined and can hold onto certain session parameters and not get cleaned up if you don’t restart all of them at the same time.

I know it is a pain…..but it seems to clear up the problem.

For a shortcut, you may also just close the window in which QC has been opened and start a new session.