-2

I'm creating a discord bot and also following a tutorial at the same time. I've managed to stumble upon an error cause by "ls -a" I'm also new to this so it would mean a lot if anyone could explain this is simple words for me to understand! Thank you

ls -a error screenshot

VLAZ
  • 26,331
  • 9
  • 49
  • 67
  • 1
    This doesn't appear to have *anything* to do with JavaScript or discordj.js. It looks like a problem with whatever shell you are using (Powershell maybe?). Please pick **appropriate** tags for your questions. See also [ask]: In particular the bit about posting text and not pictures. – Quentin Mar 01 '21 at 09:29
  • @Quentin yeah, it's PowerShell. It has some aliases for commands that are similar to the Unix commands. `ls` is `Get-ChildItem` for example. However, the extra options are rarely the same - passing `-a` to `Get-ChildItem` for example doesn't seem to work. – VLAZ Mar 01 '21 at 09:31
  • [How to show hidden files (dotfiles) with windows powershell](https://stackoverflow.com/q/50817139/995714) – phuclv Mar 02 '21 at 15:31

1 Answers1

4

That tutorial is meant for POSIXy systems such as Linux, and you're using Windows.

Windows' PowerShell happens to have an alias ls for listing items in a directory, but it does not directly support -a (which the POSIX ls command does support).

AKX
  • 152,115
  • 15
  • 115
  • 172
  • @DoNotEatDuck what do you want to do? We see the error but we don't know what your goal is. What do you need from `ls -a`? – VLAZ Mar 01 '21 at 09:34
  • the command `ls -a` lists including hidden files, the equivalent in PS is to use `Get-Childitem -Force` which will list all inclduing hidden files – Scepticalist Mar 01 '21 at 10:18
  • @Scepticalist it's *sort of* an equivalent but not quite. The difference between *NIX and Windows when it comes to hiding files is probably relevant. On *NIX systems any file or directory that starts with a dot is hidden, e.g. `.npmrc`. Listing that requires `-a`. However, on Windows, whether or not something is hidden is based on attributes of the item itself. So you can have a file called `.npmrc` but it's likely does not actually have the attribute to mark it as hidden. Most *NIX stuff on Windows don't bother hiding the dot-starting items, in term you don't need to bother with `-Force`. – VLAZ Mar 01 '21 at 12:29