nodejs - react - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type str
Posted 不咬人的兔子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nodejs - react - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type str相关的知识,希望对你有一定的参考价值。
首先react需要安装nodejs
然后安装react
https://www.runoob.com/react/react-install.html
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:117:11)
at Object.join (path.js:375:7)
at noopServiceWorkerMiddleware (D:IDEAworkxlore-util ode_modules eact-dev-utils oopServiceWorkerMiddleware.js:14:26)
at Layer.handle [as handle_request] (D:IDEAworkxlore-util ode_modulesexpresslib outerlayer.js:95:5)
at trim_prefix (D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:317:13)
at D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:284:7
at Function.process_params (D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:335:12)
at next (D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:275:10)
at launchEditorMiddleware (D:IDEAworkxlore-util ode_modules eact-dev-utilserrorOverlayMiddleware.js:20:7)
at Layer.handle [as handle_request] (D:IDEAworkxlore-util ode_modulesexpresslib outerlayer.js:95:5)
at trim_prefix (D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:317:13)
at D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:284:7
at Function.process_params (D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:335:12)
at next (D:IDEAworkxlore-util ode_modulesexpresslib outerindex.js:275:10)
at handleWebpackInternalMiddleware (D:IDEAworkxlore-util ode_modules eact-dev-utilsevalSourceMapMiddleware.js:42:7)
at Layer.handle [as handle_request] (D:IDEAworkxlore-util ode_modulesexpresslib outerlayer.js:95:5)
一般是因为版本问题。
我这边的解决办法:
- 在package.json中,把"react-scripts": "^3.3.0" 替换为"react-scripts": "^3.4.0"
- 删除node_modules文件夹
- 执行npm install 或者 yarn install重新安装依赖包(在工程所在文件夹shift + 右键 - 在此处打开命令窗口,然后输入, 或者直接cmd然后cd到所在位置也行)
然后
yarn start
启动
以上是关于nodejs - react - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type str的主要内容,如果未能解决你的问题,请参考以下文章
使用智能按钮创建 PayPal 订单 - (React/NodeJS)
NodeJS/React:拍照,然后发送到 mongoDB 存储,稍后显示