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

[docs] #12464

Open
regoutl opened this issue Jan 21, 2025 · 1 comment
Open

[docs] #12464

regoutl opened this issue Jan 21, 2025 · 1 comment
Labels
type: documentation Need to update the API documentation

Comments

@regoutl
Copy link

regoutl commented Jan 21, 2025

Hello,

I am new to tauri / npm. After cloning my tauri repo to a new machine, i did run into this

cargo tauri dev
    Running BeforeDevCommand (npm run dev)
    Info Watching [...]/src-tauri for changes...
npm error Missing script: "dev"
npm error
npm error To see a list of scripts, run:
npm error   npm run
npm error A complete log of this run can be found in: [...]/.npm/_logs/2025-01-21T00_06_36_866Z-debug-0.log
    Error The "beforeDevCommand" terminated with a non-zero status code.

the problem was that i had initialized npm in the src-tauri folder too. i.e. my folder structure was like this

ls *

frontend:
app.jsx    components  index.html  main.jsx  node_modules  package.json  package-lock.json     public  vite.config.js

src-tauri:
build.rs  capabilities  Cargo.lock  Cargo.toml  gen  icons  node_modules  package.json  package-lock.json  public  README.md  src  target  tauri.conf.json

The cargo tauri build apparently finds any subfolder with a package.json. It did hit the src-tauri one, which has no scripts defined. Hence the error.

It would be beginner friendly to have some more explicit error e.g. "tauri found 2 package.json in subfolders and cannot choose which one. You should only have npm in frontend folder"

@regoutl regoutl added the type: documentation Need to update the API documentation label Jan 21, 2025
@regoutl
Copy link
Author

regoutl commented Jan 21, 2025

note : tauri-cli 2.2.5; ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation Need to update the API documentation
Projects
None yet
Development

No branches or pull requests

1 participant