Tags:  npmvite
Source:  Twitter logo

I created a vitejs app with npm init @vitejs/app and installed threejs (npm i three).

While trying to run it using npm run dev is given an error.

Error log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.14.13
3 info using node@v14.17.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle threejs-learn@0.0.0~predev: threejs-learn@0.0.0
6 info lifecycle threejs-learn@0.0.0~dev: threejs-learn@0.0.0
7 verbose lifecycle threejs-learn@0.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle threejs-learn@0.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/saikrishnadas/sai-learn/threejs-learn/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/opt/homebrew/sbin
9 verbose lifecycle threejs-learn@0.0.0~dev: CWD: /Users/saikrishnadas/sai-learn/threejs-learn
10 silly lifecycle threejs-learn@0.0.0~dev: Args: [ '-c', 'vite' ]
11 info lifecycle threejs-learn@0.0.0~dev: Failed to exec dev script
12 verbose stack Error: threejs-learn@0.0.0 dev: `vite`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:375:28)
12 verbose stack     at maybeClose (internal/child_process.js:1055:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid threejs-learn@0.0.0
14 verbose cwd /Users/saikrishnadas/sai-learn/threejs-learn
15 verbose Darwin 21.1.0
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
17 verbose node v14.17.1
18 verbose npm  v6.14.13
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error threejs-learn@0.0.0 dev: `vite`
23 error spawn ENOENT
24 error Failed at the threejs-learn@0.0.0 dev script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]


  "name": "threejs-learn",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  "devDependencies": {
    "vite": "^2.7.1"
  "dependencies": {
    "three": "^0.135.0"

I also tried delete the node modules and installing it again

Copyright © 2022 QueryThreads

All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0).