Issue
I'm trying to build tauri app on Ubuntu 16.4.7 (LTS) by official documentation and after sudo npm run tauri dev
or sudo npm run tauri build
command i have many errors. Log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'tauri', 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretauri', 'tauri', 'posttauri' ]
5 info lifecycle [email protected]~pretauri: [email protected]
6 silly lifecycle [email protected]~pretauri: no script for pretauri, continuing
7 info lifecycle [email protected]~tauri: [email protected]
8 verbose lifecycle [email protected]~tauri: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~tauri: PATH: /usr/share/npm/bin/node-gyp-bin:/home/roman/Desktop/tauri-svelte/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
10 verbose lifecycle [email protected]~tauri: CWD: /home/roman/Desktop/tauri-svelte
11 silly lifecycle [email protected]~tauri: Args: [ '-c', 'tauri "dev"' ]
12 info lifecycle [email protected]~tauri: Failed to exec tauri script
13 verbose stack Error: [email protected] tauri: `tauri "dev"`
13 verbose stack spawn ENOENT
13 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:17:16)
13 verbose stack at emitTwo (events.js:87:13)
13 verbose stack at ChildProcess.emit (events.js:172:7)
13 verbose stack at maybeClose (internal/child_process.js:821:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/roman/Desktop/tauri-svelte
16 error Linux 4.15.0-142-generic
17 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "tauri" "dev"
18 error node v4.2.6
19 error npm v3.5.2
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error [email protected] tauri: `tauri "dev"`
24 error spawn ENOENT
25 error Failed at the [email protected] tauri script 'tauri "dev"'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the tauri-app package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error tauri "dev"
25 error You can get information on how to open an issue for this project with:
25 error npm bugs tauri-app
25 error Or if that isn't available, you can get their info via:
25 error npm owner ls tauri-app
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]
It works on windows
node --version -> 17.8.0
npm --version -> 8.5.5
Solution
Update node and npm to the latest version. If you have the latest version of node and npm, check whether the same version is getting picked by tauri. When one has multiple node version, we have to specify the version to use.
Steps :
nvm use 18.16.1
sudo npm run tauri dev
nvm is a node version manager. Used to hop between multiple node versions.
Answered By - Code learner Answer Checked By - Candace Johnson (WPSolving Volunteer)