denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.05k stars 5.31k forks source link

Error running example of 'deno task dev' #18667

Open rafaelbdb opened 1 year ago

rafaelbdb commented 1 year ago

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/esbuild@0.17.16/node_modules/esbuild/lib/main.js:2137:15)
    at build (file:///myProject/node_modules/.deno/esbuild@0.17.16/node_modules/esbuild/lib/main.js:2011:26)
    at bundleConfigFile (file:///myProject/node_modules/.deno/vite@4.2.1/node_modules/vite/dist/node/chunks/dep-79892de8.js:63875:26)
    at loadConfigFromFile (file:///myProject/node_modules/.deno/vite@4.2.1/node_modules/vite/dist/node/chunks/dep-79892de8.js:63851:31)
    at resolveConfig (file:///myProject/node_modules/.deno/vite@4.2.1/node_modules/vite/dist/node/chunks/dep-79892de8.js:63466:34)
    at createServer (file:///myProject/node_modules/.deno/vite@4.2.1/node_modules/vite/dist/node/chunks/dep-79892de8.js:62752:26)
    at CAC.<anonymous> (file:///myProject/node_modules/.deno/vite@4.2.1/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/std@0.157.0/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.

bartlomieju commented 1 year ago

Can you repeat the same problem with latest Deno release?

Anan7Codes commented 1 year ago

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)
bartlomieju commented 1 year ago

@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 commented 1 year ago

@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.

bartlomieju commented 1 year ago

Try removing the created node_modules directory and let me know if the problem persists. Which Deno version are you using?

rafaelbdb commented 1 year ago

I had this problem using MX Linux. I "solved" it by using Kubuntu. A bit drastic, but worked. Go figure...

Anan7Codes commented 1 year ago

Try removing the created node_modules directory 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.

nounder commented 1 year ago

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
RossLin007 commented 1 year ago

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