thexinkewonder
thexinkewonder
  • 发布:2022-03-04 08:45
  • 更新:2022-08-11 17:08
  • 阅读:1153

使用默认模版创建的uniapp无法通过CLI命令运行

分类:uni-app

通过终端安装默认模版之后无法运行
操作如下:

% vue create -p dcloudio/uni-preset-vue uniapp-demo  
% cd uniapp-demo  
% yarn dev:h5

运行完之后提示

Error: Cannot find module 'webpack/lib/RuleSet'

随后运行指令

% yarn add webpack@4.29.5

运行之后分别报错

Error: Cannot find module 'html-webpack-plugin'  
(在此使用yarn安装了上述的依赖)  
Error: Cannot find module 'webpack-dev-server'  
(在此使用yarn安装了上述的依赖)

在最后一次安装完依赖之后,重新运行( yarn dev:h5 )提示:

 ERROR  TypeError: Cannot convert undefined or null to object

系统版本:macOS Monterey,node 16.14.0,npm 8.5.3,yarn 1.22.17

全部提示信息:

 ERROR  TypeError: Cannot convert undefined or null to object  
TypeError: Cannot convert undefined or null to object  
    at Function.assign (<anonymous>)  
    at /Users/vorbote/Workspace/android/uniapp-demo/node_modules/@dcloudio/vue-cli-plugin-uni/lib/chain-webpack.js:30:32  
    at Object.tap (/Users/vorbote/Workspace/android/uniapp-demo/node_modules/webpack-chain/src/Use.js:14:20)  
    at /Users/vorbote/Workspace/android/uniapp-demo/node_modules/@dcloudio/vue-cli-plugin-uni/lib/chain-webpack.js:30:10  
    at Array.forEach (<anonymous>)  
    at /Users/vorbote/Workspace/android/uniapp-demo/node_modules/@dcloudio/vue-cli-plugin-uni/lib/chain-webpack.js:25:17  
    at /Users/vorbote/Workspace/android/uniapp-demo/node_modules/@vue/cli-service/lib/Service.js:268:40  
    at Array.forEach (<anonymous>)  
    at Service.resolveChainableWebpackConfig (/Users/vorbote/Workspace/android/uniapp-demo/node_modules/@vue/cli-service/lib/Service.js:268:26)  
    at Service.resolveWebpackConfig (/Users/vorbote/Workspace/android/uniapp-demo/node_modules/@vue/cli-service/lib/Service.js:272:48)  
    at PluginAPI.resolveWebpackConfig (/Users/vorbote/Workspace/android/uniapp-demo/node_modules/@vue/cli-service/lib/PluginAPI.js:132:25)  
    at serve (/Users/vorbote/Workspace/android/uniapp-demo/node_modules/@dcloudio/vue-cli-plugin-uni/commands/serve.js:51:31)  
    at Service.run (/Users/vorbote/Workspace/android/uniapp-demo/node_modules/@vue/cli-service/lib/Service.js:262:12)  
    at processTicksAndRejections (node:internal/process/task_queues:96:5)  
error Command failed with exit code 1.  
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2022-03-04 08:45 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

https://ask.dcloud.net.cn/question/135817

要回复问题请先登录注册