Reactjs ERR_INVALID_ARG_TYPE

时间:2020-02-18 00:31:00

标签: javascript reactjs

有! 我从themeforest购买了一些模板,并且所有版本都可以在预览版本中正常工作,但是在新模板中却出现了

之类的错误
> TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type
> string. Received type undefined
>         at validateString (internal/validators.js:125:11)
>         at Object.join (path.js:427:7)
>         at noopServiceWorkerMiddleware (C:\Users\Rade\Desktop\gComet-master\node_modules\react-dev-utils\noopServiceWorkerMiddleware.js:14:26)
>         at Layer.handle [as handle_request] (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\layer.js:95:5)
>         at trim_prefix (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:317:13)
>         at C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:284:7
>         at Function.process_params (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:335:12)
>         at next (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:275:10)
>         at launchEditorMiddleware (C:\Users\Rade\Desktop\gComet-master\node_modules\react-dev-utils\errorOverlayMiddleware.js:20:7)
>         at Layer.handle [as handle_request] (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\layer.js:95:5)
>         at trim_prefix (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:317:13)
>         at C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:284:7
>         at Function.process_params (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:335:12)
>         at next (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\index.js:275:10)
>         at handleWebpackInternalMiddleware (C:\Users\Rade\Desktop\gComet-master\node_modules\react-dev-utils\evalSourceMapMiddleware.js:42:7)
>         at Layer.handle [as handle_request] (C:\Users\Rade\Desktop\gComet-master\node_modules\express\lib\router\layer.js:95:5)

我认为模板不应该出现此错误,但是我仍然有。可能是什么问题?

1 个答案:

答案 0 :(得分:7)

您可以检查此链接https://github.com/ionic-team/ionic/issues/20503

要解决此问题,只需升级到"react-scripts": "^3.4.0"

  1. 用package.json中的"react-scripts": "^3.x.x"覆盖现有的"react-scripts": "^3.4.0"
  2. 删除节点模块
  3. 最后在您的命令提示符下运行npm installyarn install

我希望它能解决它。