Error running example of 'deno task dev'
My config (MX Linux 21.3):
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
$ deno --version
deno 1.32.3 (release, x86_64-unknown-linux-gnu)
v8 11.2.214.9
typescript 5.0.3
$ node --version
v18.15.0
$ npm --version
9.5.0
Trying to follow the tutorial here: https://www.youtube.com/watch?v=MDPauM8fZDE https://github.com/denoland/examples/tree/main/with-vue
$ deno run -A npm:create-vite-extra
✔ Project name: … myProject
✔ Select a template: › deno-vue
✔ Select a variant: › TypeScript
Scaffolding project in /myProject...
Done. Now run:
cd myProject
deno task dev
$ cd myProject
$ deno task dev
I get the error:
Task dev deno run -A --node-modules-dir npm:vite
failed to load config from /myProject/vite.config.mts
error when starting dev server:
TypeError: Cannot read properties of null (reading 'on')
at ensureServiceIsRunning (file:///myProject/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:2137:15)
at build (file:///myProject/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:2011:26)
at bundleConfigFile (file:///myProject/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-79892de8.js:63875:26)
at loadConfigFromFile (file:///myProject/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-79892de8.js:63851:31)
at resolveConfig (file:///myProject/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-79892de8.js:63466:34)
at createServer (file:///myProject/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-79892de8.js:62752:26)
at CAC.<anonymous> (file:///myProject/node_modules/.deno/[email protected]/node_modules/vite/dist/node/cli.js:734:30)
My 'deno.json' file:
{
"tasks": {
"dev": "deno run -A --node-modules-dir npm:vite",
"build": "deno run -A --node-modules-dir npm:vite build",
"preview": "deno run -A --node-modules-dir npm:vite preview",
"serve": "deno run --allow-net --allow-read https://deno.land/[email protected]/http/file_server.ts dist/"
}
}
My 'vite.config.mts' file:
import { defineConfig } from 'npm:vite@^4.0.4'
import vue from 'npm:@vitejs/plugin-vue@^4.0.0'
import 'npm:vue@^3.2.45'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
})
My 'src/main.ts' file
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')
I didn't change anything in those 3 files. They were generated by Deno.
I suppose there is a version issue somewhere, but I've already searched Google (and even tried ChatGPT) for hours, and can't figure out what is causing the issue.
Can you repeat the same problem with latest Deno release?
I'm getting a similar error when I run deno task dev. I was following this video.
➜ deno-react-go-server -> deno task dev
Task dev deno run -A --node-modules-dir npm:vite
error: Uncaught Error: EPERM: operation not permitted, readdir
at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:89:11)
at __node_internal_uvException (ext:deno_node/internal/errors.ts:182:12)
at denoErrorToNodeError (ext:deno_node/internal/errors.ts:1831:16)
at ext:deno_node/_fs/_fs_readdir.ts:35:22
at eventLoopTick (ext:core/01_core.js:182:11)
@Anan7Codes your issue seems to be a problem with filesystem permission on your machine, so it's not strictly related to Deno. Make sure that the user you are running with has read and write access to the whole project directory.
@Anan7Codes your issue seems to be a problem with filesystem permission on your machine, so it's not strictly related to Deno. Make sure that the user you are running with has read and write access to the whole project directory.
Cool I'll try it once again though when I ran the command the first time it worked. I couldn't see the webpage on default url localhost:5173. I closed it by pressing ctrl + c and then when I ran deno task dev again, I started receiving this error.
Try removing the created node_modules directory and let me know if the problem persists. Which Deno version are you using?
I had this problem using MX Linux. I "solved" it by using Kubuntu. A bit drastic, but worked. Go figure...
Try removing the created
node_modulesdirectory and let me know if the problem persists. Which Deno version are you using?
Tried deleting node_modules. Getting the same error. I'm using v1.34.0.
I get the same error when deno dev with project created by npm:create-vite-extra as per official docs.
deno --version
deno 1.34.3 (release, aarch64-apple-darwin)
v8 11.5.150.2
typescript 5.0.4
I get the same error . but, it ok when i use deno 1.34.1
deno --version deno 1.34.3 (release, x86_64-apple-darwin) v8 11.5.150.2 typescript 5.0.4
Edit: when I do npm install in the dinos directory the command deno task dev works, but I was under the impression that deno replaces the normal npm stuff. The tutorial also fails to mention that the npm install step is still necessary.
I get the same issue with the example in: https://docs.deno.com/runtime/tutorials/how_to_with_npm/vue/
When I follow the example I get this output:
mark@MacBook-Pro dev % deno run -A npm:create-vite
✔ Project name: … dinos
✔ Select a framework: › Vue
✔ Select a variant: › TypeScript
Scaffolding project in /Users/mark/dev/dinos...
Done. Now run:
cd dinos
npm install
npm run dev
mark@MacBook-Pro dev % cd dinos
mark@MacBook-Pro dinos % deno task dev
Task dev vite
vite: command not found
this deno version (installed with brew):
mark@MacBook-Pro dinos % deno --version
deno 2.0.2 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2
You need to run deno install (or npm install) before running deno task dev - vite: command not found means that there's no node_modules directory with proper entries in node_modules/.bin/ folder.
You need to run
deno install(ornpm install) before runningdeno task dev-vite: command not foundmeans that there's nonode_modulesdirectory with proper entries innode_modules/.bin/folder.
I already found this out and edited my comment. I was under the impression that deno made npm install obsolete (after all you also don't need to do npm run dev anymore). apparently that doesn't apply when using other frameworks through deno.
I already found this out and edited my comment. I was under the impression that deno made npm install obsolete (after all you also don't need to do npm run dev anymore). apparently that doesn't apply when using other frameworks through deno.
That's correct most frameworks operate on assumption that there will be node_modules directory and while we tried to make some of them work without it it's sort of slow grind.