Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command not found #17

Closed
Lelelo1 opened this issue Nov 14, 2021 · 6 comments
Closed

Command not found #17

Lelelo1 opened this issue Nov 14, 2021 · 6 comments

Comments

@Lelelo1
Copy link

Lelelo1 commented Nov 14, 2021

Following

yarn add svelte-sitemap --dev

It says I get [email protected] version

When I try to run svelte-sitemap in some way in terminal on mac I get:

zsh: command not found: svelte-sitemap

It's the same with installing the npm package

@bartholomej
Copy link
Owner

Hi @Lelelo1,
It looks like you have the library installed locally in the project folder (which is correct).

But then it has to be called like this:

yarn svelte-sitemap
# npm run svelte-sitemap

Let me know how it works ;)

@silvestrevivo
Copy link

silvestrevivo commented Nov 23, 2021

@bartholomej I am having the same problem and it seems the documentation is not complete. Can you define better where to put the JS content (which file and context) and how to run the script when you build the site?

Even after installing locally, it doesn't work. Thanks!!!!

BTW: how to install the TS version?

@bartholomej
Copy link
Owner

Hi @silvestrevivo,
I have slightly edited the documentation to make it clear that there are two different ways how to use this library.

As you can see, I recommend the CLI option as a postbuild hook. In the vast majority of cases, this is what you want ;)

Also see this example

{
  "name": "my-project",
  "scripts": {
    "postbuild": "npm run svelte-sitemap --domain https://mydomain.com"
  }
}

PS: If you prefer the JS/TS option, then TypeScript version is automatically available for you.

I hope it's clear now and will work for you ;)

@silvestrevivo
Copy link

@bartholomej thanks for the answer. For that I have to install the dependency globally. I would like to know how to run the package when I am in development or production, but installing locally. Thanks!

@bartholomej
Copy link
Owner

@silvestrevivo
Honestly, I'm not quite sure what problem you're solving :)
Can you write a bit more about how you proceeded?

Is it that the package now can't be called and says command not found: svelte-sitemap, as originally mentioned in this issue?
Where are you calling the script from and how are you calling it?

Is it necessary to install the package globally for you? It's always better to install it locally – directly to the project.

If you install it locally, then you can call npm run svelte-sitemap and it will work in some CI/CD container as well.

@silvestrevivo
Copy link

silvestrevivo commented Nov 23, 2021

@bartholomej I am installing the package locally and then adding the "postbuild" script as you mentioned in my package.json and I get this error when I run npm run build:

missing script: svelte-sitemap

Since the package is globally installed, the script is missed locally. In fact, developing on Vercel with the static adapter, it breaks the deployment. I hope this makes sense :)

@bartholomej no worries. In #16 I found the solution. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants