Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows11 环境安装失败 #16133

Closed
yiky84119 opened this issue Jul 21, 2024 · 4 comments
Closed

Windows11 环境安装失败 #16133

yiky84119 opened this issue Jul 21, 2024 · 4 comments
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@yiky84119
Copy link

yiky84119 commented Jul 21, 2024

相关平台

微信小程序

小程序基础库: 3.15
使用框架: Vue 2

复现步骤

安装Node.js 20.15.1 或 18.20.4
npm install -g @tarojs/cli
输入命令taro,提示 Error: Cannot find module '@swc/types'

期望结果

正常初始化项目

实际结果

Error: Cannot find module '@swc/types'

环境信息

命令执行失败,无法获取
Taro v3.6.34

  Taro CLI 3.6.34 environment info:
    System:
      OS: Windows 11 专业版 23H2

补充信息

Node.js v20.15.1
PS C:\Users\Nevo> taro init myApp
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '@swc/types'
Require stack:
- C:\Users\Nevo\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@swc\core\index.js
- C:\Users\Nevo\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\helper\dist\index.js
- C:\Users\Nevo\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\helper\index.js
- C:\Users\Nevo\AppData\Roaming\npm\node_modules\@tarojs\cli\dist\util\index.js
- C:\Users\Nevo\AppData\Roaming\npm\node_modules\@tarojs\cli\bin\taro
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (C:\Users\Nevo\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@swc\core\index.js:51:14)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Nevo\\AppData\\Roaming\\npm\\node_modules\\@tarojs\\cli\\node_modules\\@swc\\core\\index.js',
    'C:\\Users\\Nevo\\AppData\\Roaming\\npm\\node_modules\\@tarojs\\cli\\node_modules\\@tarojs\\helper\\dist\\index.js',
    'C:\\Users\\Nevo\\AppData\\Roaming\\npm\\node_modules\\@tarojs\\cli\\node_modules\\@tarojs\\helper\\index.js',
    'C:\\Users\\Nevo\\AppData\\Roaming\\npm\\node_modules\\@tarojs\\cli\\dist\\util\\index.js',
    'C:\\Users\\Nevo\\AppData\\Roaming\\npm\\node_modules\\@tarojs\\cli\\bin\\taro'
  ]
}

Node.js v20.15.1
@taro-bot2 taro-bot2 bot added F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 21, 2024
@y779102260
Copy link

mac node21也出现此问题

@y779102260
Copy link

锁个版本解决

"resolutions": {
  "@swc/types": "0.1.9"
}

原因:没打包cjs就发版了
image

@github-project-automation github-project-automation bot moved this from Todo to Done in Mini Program Jul 21, 2024
This was referenced Jul 27, 2024
@luckercs
Copy link

这个问题怎么解决呢?也遇到了同样的问题,初始化项目就失败了 @Psli @yiky84119 @y779102260

@nocpp
Copy link

nocpp commented Nov 21, 2024

这个问题怎么解决呢?也遇到了同样的问题,初始化项目就失败了 @Psli @yiky84119 @y779102260

package.json加一行:"@swc/types": "0.1.9"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Archived in project
Development

No branches or pull requests

4 participants