Kyler Shaw

Junior Member
Oct 30, 2017
4
0
1
I initially downloaded the node.js software so that I could create my own bot in Discord (Unrelated).

In doing so, I began the process of this form https://medium.com/@renesansz/tutorial-creating-a-simple-discord-bot-9465a2764dc0.

The process where it says run "npm install discord.io winston --save" in the command prompt, wasn't working. Honestly, I don't have much knowledge in Nodes in javascript, so I began to research on why it didn't work. Essentially, I changed the PATH in my environment variables in my system to the destination I wanted them downloaded for my bot.

That didn't work..

So I went back to researching, and I noticed a file called npmrc in the node.js folder, where there i changed the prefix=" " section in the notepad. (oops)

(I think) that's what caused the error I'm receiving now in the command prompt when I try to access ANYTHING npm related. (see link below)

https://imgur.com/a/vaE43
vaE43


I've tried a number of things to fix this:
  • looking at the code files where the errors are reporting and couldn't conclude much of anything
  • uninstalling and reinstalling node.js
  • deleting ALL files related to node.js and doing the above.
  • resetting the file I messed with
  • googling the **** out of essentially everything, not much came up relating to this issue.
  • resetting the PATH environment variables to their defaults
  • Probably others I've forgotten by now
If it's at all relevant, I'm able to access the node -v in the command prompt just fine, but working with NPM is what messes up (Can't run npm -v without a huge error section as if something is wrong with the code).

I'd also like to note that the first like after npm -v in the image, it references a location that no longer exists (D:\Bot_folder_(discord)\Greeter=). This location is what I originally replaced the PATH with, and what was in the prefix section in the npmrc folder.

Thanks in advance to everyone that helps!!
 

purbeast0

No Lifer
Sep 13, 2001
52,879
5,744
126
When you say it "wasnt working" after running the npm command, what do you mean exactly. What was the exact error you got?

You definitely do not need to make any changes down inside of the nodeJS installation so I would revert any of those changes you made.
 

Cogman

Lifer
Sep 19, 2000
10,277
125
106
ooohhh.. You may have really messed things up (like, reinstall your OS levels). Getting the path messed up can hork up a ton of stuff.

My suggestion, don't screw around with your PATH. The most you should do (which the installer should do anyways) is add the node bin folder to you path. Other changes simply aren't needed.

Npm, by default, installs all packages to the CWD. So, it is simply not necessary to try and isolate things. The only time npm will install something globally is if you add the -g tag.

But seriously, screwing around with path is one of those things that if you don't have a restore available, you seriously might be better off doing a fresh install. So many apps push garbage onto the path that it is almost unknowable what will be screwed up if you wipe the whole thing.

At a minimum:

[*] try to restore your path to whatever it was before you screwed around with it.
[*] uninstall/reinstall node
[*] try again without pushing garbage on the path

If you are getting more errors, post them. The most common node errors I've seen have been related to the fact that people will pull in dependencies on other languages into their packages (I HATE that btw). The solution is often just to install python/c build tools/ruby.
 

Kyler Shaw

Junior Member
Oct 30, 2017
4
0
1
When you say it "wasnt working" after running the npm command, what do you mean exactly. What was the exact error you got?

You definitely do not need to make any changes down inside of the nodeJS installation so I would revert any of those changes you made.

See the image in the original post, that's the error I get. As for restoring the value, that's kind of the issue I have at the moment. Restoring isn't quite working from what it seems. (Restoring as in uninstalling and reinstalling everything)
 

Kyler Shaw

Junior Member
Oct 30, 2017
4
0
1
ooohhh.. You may have really messed things up (like, reinstall your OS levels). Getting the path messed up can hork up a ton of stuff.

My suggestion, don't screw around with your PATH. The most you should do (which the installer should do anyways) is add the node bin folder to you path. Other changes simply aren't needed.

Npm, by default, installs all packages to the CWD. So, it is simply not necessary to try and isolate things. The only time npm will install something globally is if you add the -g tag.

But seriously, screwing around with path is one of those things that if you don't have a restore available, you seriously might be better off doing a fresh install. So many apps push garbage onto the path that it is almost unknowable what will be screwed up if you wipe the whole thing.

At a minimum:

[*] try to restore your path to whatever it was before you screwed around with it.
[*] uninstall/reinstall node
[*] try again without pushing garbage on the path

If you are getting more errors, post them. The most common node errors I've seen have been related to the fact that people will pull in dependencies on other languages into their packages (I HATE that btw). The solution is often just to install python/c build tools/ruby.

When I said I messed with the PATH variable, I was relating to the user variable, not the system variable (Okay, I did add a few thing in there, but they go deleted). Can you elaborate on what you mean by pushing garbage on the path?

I'd also like to note that when I uninstall node.js and try to run the npm command it doesn't work (I don't know if this is relevant at all, just in case it might help. I makes sense to why it doesn't work because it was UNINSTALLED). But when I reinstall the file the npm command starts having the same error as seen in the OG image. My guess here is that either the file is still messed up or something else?


Thanks a lot for the response man!
 

Cogman

Lifer
Sep 19, 2000
10,277
125
106
Can you elaborate on what you mean by pushing garbage on the path?

Certainly. Many programs request what to run based on known and standard path variables. Usually, you put the most important stuff on the far left and least important stuff on the far right. If you switch the order of stuff in the path, you can get into a situation where applications expecting a standard system path item get something entirely different.

For example, npm could be expecting to have windows cd in the path, however, you might have switch it out for the cygwin version of cd. In that case, npm can be asking for one behavior and getting something completely different.

A screwed up path can have a bunch of unpredictable results on applications running, with some outright failing to run.

I'm and work and they block imgur (but I looked it up on my phone). FYI, in the future it would be easier to see that as text in the post rather than as an image.

Have you tried, after uninstalling, completely deleting out all directories related to npm. It drops some in the User directory as well as the program files (mentioned in stack trace).

Also what version of node are you using? If it is 8 have you tried 6 and vice versa?

You could always try to just upgrade npm after installing and before doing anything else (see https://www.npmjs.com/package/self-update/tutorial )

Finally, you might also give up on npm and install yarn :D
 

Kyler Shaw

Junior Member
Oct 30, 2017
4
0
1
For example, npm could be expecting to have windows cd in the path, however, you might have switch it out for the cygwin version of cd. In that case, npm can be asking for one behavior and getting something completely different.

A screwed up path can have a bunch of unpredictable results on applications running, with some outright failing to run.

I'm and work and they block imgur (but I looked it up on my phone). FYI, in the future it would be easier to see that as text in the post rather than as an image.

Have you tried, after uninstalling, completely deleting out all directories related to npm. It drops some in the User directory as well as the program files (mentioned in stack trace).

I haven't tried anything you have said but I wanted to focus on when you said above. To my knowledge, all the PATH system variables are in order of what they should be. What I had actually changed was the user variable path which is really only linked to the users %APPDATA% so I restored that. Thus far, I haven't had any software/application fails or errors other than the npm one.

I'll get to you on trying out the 6 version instead of the 8

Thanks a lot!