如果你taro init myApp 项目选择的是云开发模板或者myApp目录下还有个client目录
请接着往下看,若不是,可能与我遇到的问题不同。错误信息见最下面:
此时如果按照官方文档大家会在myApp目录下面使用yarn安装依赖:
其实当前的myApp目录下并不是我们的开发目录,需要cd到 client 目录下,然后再运行 yarn安装依赖
安装依赖:
这样就是安装成功了
运行 yarn dev:weapp时,也要在client目录下哦。
错误信息:
(node:7392) UnhandledPromiseRejectionWarning: Error: Cannot find module '@tarojs/plugin-platform-weapp' from 'C:\Users\Administrator\Desktop\myApp\client'
at Function.resolveSync [as sync] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\node_modules\resolve\lib\sync.js:81:15)
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\utils\index.js:46:31
at Array.map (<anonymous>)
at Object.resolvePresetsOrPlugins (C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\utils\index.js:45:30)
at Kernel.resolvePlugins (C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:90:36)
at Kernel.initPresetsAndPlugins (C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:81:14)
at Kernel.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:40:18)
at Generator.next (<anonymous>)
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:8:71
at new Promise (<anonymous>)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:7392) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 4.92s.