uniapp TypeError: Cannot read property 'replace' of undefined
webstorm中运行uniapp:npm run dev:h5
错误信息如下:
D:\uniapp-Project\cga-miniapp-208\4-Invoice>npm run dev:h5
> 4-Invoice@0.1.0 dev:h5 D:\uniapp-Project\cga-miniapp-208\4-Invoice
> cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve
D:\uniapp-Project\cga-miniapp-208\4-Invoice\node_modules\@dcloudio\uni-cli-shared\lib\util.js
:7
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
^
TypeError: Cannot read property 'replace' of undefined
at normalizePath (D:\uniapp-Project\cga-miniapp-208\4-Invoice\node_modules\@dcloudio\uni-
cli-shared\lib\util.js:7:45)
.........
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! 4-Invoice@0.1.0 dev:h5: `cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-serv
ice uni-serve`
npm ERR! Exit status 7
npm ERR! npm ERR!
npm ERR! Failed at the 4-Invoice@0.1.0 dev:hnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2021-10-29T03_00_03_526Z-debug.log
解决方法:把错误所在的包重新下载即可
如上述错误所在位置为:node_modules\@dcloudio\uni- cli-shared\lib\util.js:7:45
本文来自博客园,作者:1940,转载请注明原文链接:https://www.cnblogs.com/beiyi-Lin/p/15479481.html