Repository: tldraw/tldraw

Issue #1882: local development, i yarn install in root dir, and in /apps/examples/, run yarn && yarn dev, get the error 
Created: 2023-09-16T10:28:59Z
10:26:47 [vite] Internal server error: Failed to resolve import "@tldraw/tldraw/tldraw.css" from "src\examples\UserPresenceExample.tsx". Does the file exist?
  Plugin: vite:import-analysis
  File: D:/tldraw/apps/examples/src/examples/UserPresenceExample.tsx:3:7
  1  |  import { jsxDEV } from "react/jsx-dev-runtime";
  2  |  import { InstancePresenceRecordType, Tldraw } from "@tldraw/tldraw";
  3  |  import "@tldraw/tldraw/tldraw.css";
     |          ^
  4  |  import { useRef } from "react";
  5  |  const USER_NAME = "huppy da arrow";
      at formatError (file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:42597:46)
      at TransformContext.error (file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:42593:19)
      at normalizeUrl (file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:40509:33)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:40652:47
      at async Promise.all (index 2)
      at async TransformContext.transform (file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:40578:13)
      at async Object.transform (file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:42871:30)
      at async loadAndTransform (file:///D:/tldraw/node_modules/vite/dist/node/chunks/dep-f7d05e3f.js:53335:29)

Duplicate issue #2369: [Bug]: Unable to Run Yarn and Yarn Dev
Created: 2023-12-21T06:22:24Z
What happened?
Description
I forked and cloned the repository to my local system, following the provided instructions to set up the local development environment. However, I encountered issues when running yarn and yarn dev. Below are the details of the error along with the versions used and system information.
Logs
Yarn Log
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @auto-it/npm@npm:10.46.0 doesn't provide typescript (p064ed), requested by @auto-it/core
➤ YN0002: │ @auto-it/released@npm:10.46.0 doesn't provide typescript (p04900), requested by @auto-it/core
➤ YN0002: │ @auto-it/version-file@npm:10.46.0 doesn't provide typescript (p60e3b), requested by @auto-it/core
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [1083e] doesn't provide typescript (p8ded4), requested by ts-node    
➤ YN0002: │ @tldraw/assets@workspace:packages/assets doesn't provide typescript (p8f881), requested by ts-node-dev
➤ YN0002: │ @tldraw/store@workspace:packages/store doesn't provide react (pb1409), requested by @tldraw/state
➤ YN0002: │ @tldraw/tlschema@workspace:packages/tlschema doesn't provide react (p38abe), requested by @tldraw/state
➤ YN0002: │ auto@npm:10.46.0 doesn't provide typescript (p78071), requested by @auto-it/core
➤ YN0002: │ config@workspace:config doesn't provide eslint (pee0a8), requested by eslint-config-prettier
➤ YN0002: │ config@workspace:config doesn't provide eslint (p7d3d5), requested by eslint-plugin-react
➤ YN0002: │ examples.tldraw.com@workspace:apps/examples doesn't provide @babel/core (p3c91a), requested by @babel/plugin-proposal-decorators
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide eslint (p8dae3), requested by @typescript-eslint/eslint-plugin    
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide eslint (p6ef29), requested by @typescript-eslint/parser
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide react (p30fd0), requested by @tldraw/editor
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide react (pab13c), requested by @tldraw/tldraw
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide react-dom (p68b55), requested by @tldraw/editor
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide react-dom (p7b53d), requested by @tldraw/tldraw
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide typescript (pb7509), requested by ts-loader
➤ YN0002: │ tldraw-vscode@workspace:apps/vscode/extension doesn't provide webpack (p07c3d), requested by ts-loader
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 523ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ z-schema@npm:5.0.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zod-validation-error@npm:1.3.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zod@npm:3.21.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zwitch@npm:2.0.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 7s 406ms
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.17.17 must be built because it never has been before or the last one failed
➤ YN0007: │ @swc/core@npm:1.3.55 [f6144] must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.14.47 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.18.14 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.31.1 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.16.3 must be built because it never has been before or the last one failed
➤ YN0007: │ keytar@npm:7.9.0 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.17.6 must be built because it never has been before or the last one failed
➤ YN0007: │ deasync@npm:0.1.28 must be built because it never has been before or the last one failed
➤ YN0000: │ core-js@npm:3.31.1 STDOUT Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
➤ YN0000: │ core-js@npm:3.31.1 STDOUT 
➤ YN0000: │ core-js@npm:3.31.1 STDOUT The project needs your help! Please consider supporting core-js:
➤ YN0000: │ core-js@npm:3.31.1 STDOUT > https://opencollective.com/core-js
➤ YN0000: │ core-js@npm:3.31.1 STDOUT > https://patreon.com/zloirock
➤ YN0000: │ core-js@npm:3.31.1 STDOUT > https://boosty.to/zloirock
➤ YN0000: │ core-js@npm:3.31.1 STDOUT > bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
➤ YN0000: │ core-js@npm:3.31.1 STDOUT
➤ YN0000: │ core-js@npm:3.31.1 STDOUT I highly recommend reading this: https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md
➤ YN0000: │ core-js@npm:3.31.1 STDOUT
➤ YN0000: │ deasync@npm:0.1.28 STDOUT Usage Error: Couldn't find a script name "node-gyp" in the top-level (used by deasync@npm:0.1.28). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.
➤ YN0000: │ deasync@npm:0.1.28 STDOUT 
➤ YN0000: │ deasync@npm:0.1.28 STDOUT $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
➤ YN0000: │ deasync@npm:0.1.28 STDERR Build failed
➤ YN0009: │ deasync@npm:0.1.28 couldn't be built successfully (exit code 1, logs can be found here: C:\Users\ROSHAN~1\AppData\Local\Temp\xfs-c29775f4\build.log)
➤ YN0007: │ vercel@npm:28.20.0 must be built because it never has been before or the last one failed
➤ YN0007: │ @tldraw/monorepo@workspace:. must be built because it never has been before or the last one failed
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT husky - Git hooks installed
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT lazyrepo 0.0.0-alpha.27
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT -----------------------
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT Loaded config file: lazy.config.ts
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT 
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> hashed 263/263 files in 1.30s
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> cache miss, no previous manifest found
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> RUN tsx D:/osc/tldraw/scripts/refresh-assets.ts in ./
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> (node:9356) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> --import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///D%3A/osc/tldraw/node_modules/tsx/dist/loader.js", pathToFileURL("./"));'
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> (Use `node --trace-warnings ...` to show where the warning was created)
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> Copying icons...
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> Copying embed icons...
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> Copying translations...
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> Done!
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> input manifest: .lazy/refresh-assets/manifest.tsv
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT refresh-assets::<rootDir> ✔ done in 16.39s
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT      Tasks:  1 successful, 1 total
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT     Cached:  0/1 cached
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT       Time:  16.49s
➤ YN0000: │ @tldraw/monorepo@workspace:. STDOUT
➤ YN0000: └ Completed in 3m 16s
➤ YN0000: Done with warnings in 3m 24s

Yarn Dev Log
lazyrepo 0.0.0-alpha.27
-----------------------
Loaded config file: lazy.config.ts

refresh-assets::<rootDir> input manifest: .lazy/refresh-assets/manifest.tsv
refresh-assets::<rootDir> output log: .lazy/refresh-assets/output.log
refresh-assets::<rootDir> ✔ cache hit ⚡️ in 0.04s
dev::apps/examples cache disabled
dev::apps/examples RUN vite --host in apps/examples
dev::packages/tldraw cache disabled
dev::packages/tldraw RUN chokidar '../{editor/src/lib/editor,tldraw/src/lib/ui}.css' -c 'node ./scripts/copy-css-files.mjs' --initial in packages/tldraw
dev::apps/examples 'vite' is not recognized as an internal or external command,
dev::apps/examples operable program or batch file.
dev::apps/examples  ERROR OUTPUT 
'vite' is not recognized as an internal or external command,
operable program or batch file.

dev::apps/examples ∙ ERROR ∙ failed
dev::packages/tldraw 'chokidar' is not recognized as an internal or external command,
dev::packages/tldraw operable program or batch file.
dev::packages/tldraw  ERROR OUTPUT 
'chokidar' is not recognized as an internal or external command,
operable program or batch file.

dev::packages/tldraw ∙ ERROR ∙ failed

Failed tasks: dev::apps/examples, dev::packages/tldraw

     Tasks:  1 successful, 2 failed, 3 total
    Cached:  1/3 cached
      Time:  0.18s

Expected Behavior
The project should set up successfully, and yarn and yarn dev should run without errors.
Environment Information

Operating System: Windows 10
Node: 20.10.0
Yarn: 3.5.0

Note
These logs are from a clean fork and clone without any modifications made to the files.
Please let me know if you need any further details or clarification.
How can we reproduce the bug?

Fork the repository.
Clone the fork to a local directory.
Follow setup instructions.
Run yarn and yarn dev.

What browsers are you seeing the problem on?
No response
Contact Details
mishraabhishek@gmail.com
Code of Conduct

 I agree to follow this project's Code of Conduct

Closing comment (2023-12-26T10:10:03Z): Isn't this issue the same as #1882 (comment)?
I was able to resolve the error by adding some global packages and copying tldraw.css.