question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not find files when using concurrently

See original GitHub issue

I have the following pipe:

"scripts": {
  "build": "concurrently -g npm:build:*",
  "build:generate-db": "ts-node ./converter/main.ts",
  "build:tailwind": "npx tailwindcss -i ./src/input.css -o ./static/css/build.css --minify",
  "build:hugo": "hugo --minify",
},
  • build:generate-db: Create .md files for hugo application from a database.
  • build:tailwind: Generates tailwind file and puts it in correct folder
  • build:hugo: Creates hugo website with .md files and tailwind file.

When I run the script hugo is not finding the .md files. When I run the script a second time hugo finds the .md files and create the website correct.

When I try this config, it’s working:

"scripts": {
  "build": "concurrently -g npm:build:* & hugo --minify",
  "build:generate-db": "npm run converter",
  "build:tailwind": "npx tailwindcss -i ./src/input.css -o ./static/css/build.css --minify",
}

What I tried:

  • First I thought the problem is the time the file write requires (so hugo is trying to find the files before they got written). This is not the case: Even when I sleep 10 seconds after build:generate-db hugo is not able to find the files as well.
  • When I run build:generate-db and than build:hugo it’s working.
  • The tailwind file is created correctly. (it’s also file write so why is this one working?)

The Converter writes like this:

writeFileSync(`${resultPath}/${data[titleKey]}.md`, JSON.stringify(resultDto, null, 2))

Here is the related stack overflow: https://stackoverflow.com/questions/71978982/hugo-can-not-find-created-files-by-node-when-using-concurrently

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
paescujcommented, Apr 26, 2022

I think the -g option does not really run the scripts sequentially, it just pretends to do so. From the docs:

  -g, --group           Order the output as if the commands were run
                        sequentially.

Why are you using concurrently for this? Since it seems like your scripts need to be run one after the other and in exact order…

1reaction
gustavohenkecommented, May 1, 2022

I’ll close this issue as it seems it’s a no-op for concurrently, but feel free to continue discussing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't npm find my commands when using concurrently
I want to call multiple commands with the dev command. I found here that using concurrently is the best way to make this...
Read more >
'concurrently' is not recognized as an internal or external ...
To solve the error "'concurrently' is not recognized as an internal or external command, operable program or batch file", install the package globally...
Read more >
concurrently - npm
Start using concurrently in your project by running `npm i ... The tool is written in Node.js, but you can use it to...
Read more >
Frequently asked questions (FAQ) for Azure Files
Get answers to Azure Files frequently asked questions. You can mount Azure file shares concurrently on cloud or on-premises Windows, Linux, ...
Read more >
session - Amazon Web Services - Go SDK
Sessions are safe to use concurrently as long as the Session is not being modified. Sessions should be cached when possible, because creating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found