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