Skip to content

The "path" argument must be of type string. Received undefined on initial start from Template › One + Zero #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jjr2527 opened this issue Feb 11, 2025 · 9 comments

Comments

@jjr2527
Copy link

jjr2527 commented Feb 11, 2025

Current Behavior

npx one
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

Hello. Let's create a new ① app...

✔ Name … someapp

✔ Template › One + Zero

pnpm package manager

Navigate to start page and receive the following error

The "path" argument must be of type string. Received undefined

    at validateString (node:internal/validators:162:11)
    at join (node:path:1175:7)

Expected Behavior

Expect to see the base template app

One Version

latest

Platform (Web, iOS, Android)

Web

Reproduction

npx one
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

  Hello. Let's create a new ①  app...

✔ Name … someapp


✔ Template › One + Zero

pnpm package manager

Navigate to start page and receive the following error


The "path" argument must be of type string. Received undefined

    at validateString (node:internal/validators:162:11)
    at join (node:path:1175:7)

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) x64 Apple M1
    Memory: 256.82 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.12.0 - /usr/local/bin/pnpm
    bun: 1.2.1 - ~/.bun/bin/bun
  Browsers:
    Chrome: 132.0.6834.160
    Safari: 17.6
  npmPackages:
    @react-native-community/cli: 15.1.3 => 15.1.3
    @rocicorp/zero: ^0.12.2025012501 => 0.12.2025013100
    @tamagui/config: ^1.124.7 => 1.124.8
    @tamagui/linear-gradient: ^1.124.7 => 1.124.8
    @tamagui/lucide-icons: ^1.124.7 => 1.124.8
    @tamagui/themes: ^1.124.7 => 1.124.8
    @tamagui/toast: ^1.124.7 => 1.124.8
    @tamagui/vite-plugin: ^1.124.7 => 1.124.8
    @tauri-apps/api: ^2 => 2.2.0
    @tauri-apps/cli: ^2 => 2.2.7
    @tauri-apps/plugin-deep-link: ^2.0.1 => 2.2.0
    @tauri-apps/plugin-fs: ^2.2.0 => 2.2.0
    @tauri-apps/plugin-shell: ^2 => 2.2.0
    @types/node: ^22.1.0 => 22.13.1
    @types/pg: ^8.11.11 => 8.11.11
    @vxrn/better-auth: 1.1.440 => 1.1.440
    @vxrn/color-scheme: 1.1.440 => 1.1.440
    @vxrn/emitter: 1.1.440 => 1.1.440
    better-auth: ^1.1.15 => 1.1.17
    expo: ~52.0.17 => 52.0.32
    one: 1.1.440 => 1.1.440
    pg: ^8.13.1 => 8.13.2
    react: ^19.0.0 => 19.0.0
    react-native: ^0.76.5 => 0.76.7
    react-native-reanimated: ~3.16.5 => 3.16.7
    react-native-safe-area-context: 4.10.5 => 4.10.5
    react-native-screens: 4.4.0 => 4.4.0
    react-native-svg: 15.8.0 => 15.8.0
    react-native-web: ^0.19.12 => 0.19.13
    tamagui: ^1.124.7 => 1.124.8
    tsx: ^4.19.0 => 4.19.2
    typescript: ^5.7.3 => 5.7.3
    vite: ^6.1.0 => 6.1.0
@MioQuispe
Copy link

Also getting this error with the latest one

@natew
Copy link
Collaborator

natew commented Mar 3, 2025

Can you verify if it works with other package managers?

@MioQuispe
Copy link

Can you verify if it works with other package managers?

Hey, I just tried with bun and getting the same issue as with npm

 ⓵  [spa] http://localhost:8081/ resolved to app/index.tsx
7:44:40 PM [vite] Internal server error: The "path" argument must be of type string. Received undefined
      at validateString (node:internal/validators:162:11)
      at join (node:path:1175:7)
      at LoadPluginContext.load (file:///Users/user/projects/open-gym-tracker/node_modules/@vxrn/compiler/dist/esm/index.mjs:46:57)
      at EnvironmentPluginContainer.load (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:47603:17)
      at async loadAndTransform (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:41252:22)
 ⓵  [spa] http://localhost:8081/favicon.ico resolved to ‼️ 404 not found
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
7:44:40 PM [vite] (client) Pre-transform error: The "path" argument must be of type string. Received undefined
 ⓵  [spa] http://localhost:8081/ resolved to app/index.tsx
7:44:40 PM [vite] Internal server error: The "path" argument must be of type string. Received undefined
      at validateString (node:internal/validators:162:11)
      at join (node:path:1175:7)
      at LoadPluginContext.load (file:///Users/user/projects/open-gym-tracker/node_modules/@vxrn/compiler/dist/esm/index.mjs:46:57)
      at EnvironmentPluginContainer.load (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:47603:17)
      at async loadAndTransform (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:41252:22)
      at async viteTransformMiddleware (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:42781:24)
 ⓵  [spa] http://localhost:8081/favicon.ico resolved to ‼️ 404 not found
 ⓵  [spa] http://localhost:8081/ resolved to app/index.tsx
7:44:42 PM [vite] Internal server error: The "path" argument must be of type string. Received undefined
      at validateString (node:internal/validators:162:11)
      at join (node:path:1175:7)
      at LoadPluginContext.load (file:///Users/user/projects/open-gym-tracker/node_modules/@vxrn/compiler/dist/esm/index.mjs:46:57)
      at EnvironmentPluginContainer.load (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:47603:17)
      at async loadAndTransform (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:41252:22)
      at async viteTransformMiddleware (file:///Users/user/projects/open-gym-tracker/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:42781:24)
 ⓵  [spa] http://localhost:8081/favicon.ico resolved to ‼️ 404 not found

@MioQuispe
Copy link

MioQuispe commented Mar 3, 2025

@natew I added a temporary fix to get it running. This solved it:

/node_modules/@vxrn/compiler/dist/esm/index.mjs

Added:

import { fileURLToPath } from "node:url";
import { extname, join, sep, dirname } from "node:path";

and line 46, changed to:

load: id => id === runtimePublicPath ? readFileSync(join(dirname(fileURLToPath(import.meta.url)), "refresh-runtime.js"), "utf-8") : void 0

Im not sure if its the best way to fix it, but it works now. seems import.meta.dirname was causing the issue

@steven6662333
Copy link

steven6662333 commented Mar 31, 2025

Tip

It appears that I have successfully resolved the issue. Below is the solution in both English and Chinese versions (Chinese version is the authoritative one). I have used an LLM to complete the English writing and the bilingual Markdown formatting. Please refer to the Chinese version as the definitive source.

Chinese version for this tip:

我似乎成功解决了这个问题,以下是解决方案的双语版本(中文版本为准)。我的英语水平有限,因此使用了llm完成了英文部分的撰写以及中英文的 Markdown 排版。希望这对您有帮助。中文版本将附在文末。

Solution for "path" argument error in Issue #496

I encountered the same "path" argument must be of type string. Received undefined error when using both nvm + npm and nvm + yarn combinations. Downgrading React from v19 to v18 and using npm install --force did not resolve the issue. After investigation, I suspect this might relate to how nvm handles symbolic links in its node version management.

Steps to Fix:

  1. Uninstall nvm
    Remove the nvm directory:

    rm -rf ~/.nvm  
  2. Delete project node_modules

    cd path/to/your/project
    rm -rf ./node_modules  
  3. Install Volta (node version manager)
    Refer to Volta's official guide

  4. Pin specific node & yarn versions

    cd path/to/your/project
    volta pin [email protected]  
    volta pin [email protected]  
  5. Reinstall dependencies

    yarn install  
  6. Start development server

    yarn run dev  

After following these steps, the error was resolved.


My vite.config.ts file is consistent with the one in the official One Stack Get Started Guide and the one which is generated by npx one. The package.json will be attached after the Chinese version.

Chinese version

我在使用 nvm + npmnvm + yarn 组合时遇到了相同的 "path" argument must be of type string. Received undefined 错误。尝试将 React 从 v19 降级到 v18 并使用 npm install --force 均未解决问题。经过排查,怀疑问题可能与 nvm 的符号链接处理机制有关。

解决步骤:

  1. 卸载 nvm
    删除 nvm 目录:

    rm -rf ~/.nvm  
  2. 删除项目 node_modules

    cd path/to/your/project
    rm -rf ./node_modules  
  3. 安装 Volta(节点版本管理工具)
    参见Volta官方教程

  4. 固定 node 和 yarn 版本

    cd path/to/your/project
    volta pin [email protected]  
    volta pin [email protected]  
  5. 重新安装依赖

    yarn install  
  6. 启动开发服务器

    yarn run dev  

我的vite.config.ts文件是与One Stack官方在Get Started教程中给出的和由npx one生成的一致的。package.json如下:

{
  "name": "one-app",
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "one dev",
    "build": "one build",
    "serve": "one serve"
  },
  "dependencies": {
    "one": "latest",
    "peerjs": "^1.5.4",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-native": "^0.76.5",
    "react-native-web": "^0.19.12"
  },
  "devDependencies": {
    "vite": "^6"
  },
  "volta": {
    "node": "20.19.0",
    "yarn": "4.8.1"
  }
}

@steven6662333
Copy link

steven6662333 commented Mar 31, 2025

By the way, I locked the versions of react and react-dom in package.json. One reason is that I wanted to downgrade from react 19 (as provided in the official Get Started guide) to react 18. The other reason is that I encountered an npm install error due to version mismatch between react and react-dom when using nvm + npm (please forgive me for not being able to provide the log at that time). Therefore, I manually specified their versions and executed npm install --force to bypass the error caused by version mismatch between react and react-native. (It seems that One Stack mentioned in their Feature introduction that they have done some adaptation work in this regard, but the conclusion is that warnings still appear. I'm not sure if it's a misunderstanding on my part. If anyone could kindly explain it to me in simple terms, that would be great.)

Chinese version

顺带一提,我在package.json中锁定了react和react-dom版本,其一是因为我想从官方Get Start的react19降级到react18,其二是因为我在nvm+npm时遇到了react和react-dom版本不匹配的npm install报错(请原谅我无法提供当时的日志),因此手动指定了它们的版本并执行了npm install --force以绕过react和react-native版本不匹配的报错(似乎One Stack在他们的Feature介绍中提到了他们有进行这一适配工作,但结论是warning仍然出现。不知是否是我理解问题,如果有哪位可以向我简单解释一下就再好不过了)

@steven6662333
Copy link

For the "adaptation of the mismatch between react and react-native" I've mentioned, I found it [here】(https://onestack.dev/docs/features

Swaps between React 18 for native and React 19 for web

@steven6662333
Copy link

For more info:
os: win11, wsl2, ubuntu2204
platform: web

@natew
Copy link
Collaborator

natew commented Mar 31, 2025

@zetavg seems a simple fix we can land

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants