在 alpine 中 taro init 之后 提示缺少 @tarojs/binding-linux-x64-musl

0yg35tkg  于 3个月前  发布在  Linux
关注(0)|答案(2)|浏览(99)

相关平台

微信小程序

小程序基础库: 3.8.5
使用框架: Preact

复现步骤

$ pnpm dev:h5

> circleshop@1.0.0 dev:h5 /home/project/MiniprogramWorkSpace/circleshop
> npm run build:h5 -- --watch

> circleshop@1.0.0 build:h5
> taro build --type h5 --watch

👽 Taro v4.0.4

Error: Cannot find module '@tarojs/binding-linux-x64-musl'
Require stack:
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+binding@4.0.4/node_modules/@tarojs/binding/binding.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/dist/create/project.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/dist/index.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/index.js
- /home/project/MiniprogramWorkSpace/circleshop/config/index.ts
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+service@4.0.4/node_modules/@tarojs/service/dist/Config.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+service@4.0.4/node_modules/@tarojs/service/dist/index.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+service@4.0.4/node_modules/@tarojs/service/index.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/dist/cli.js
- /home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/bin/taro
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Function.Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+binding@4.0.4/node_modules/@tarojs/binding/binding.js:175:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.newLoader [as .js] (/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/pirates@4.0.6/node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+binding@4.0.4/node_modules/@tarojs/binding/binding.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/dist/create/project.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/dist/index.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/index.js',
    '/home/project/MiniprogramWorkSpace/circleshop/config/index.ts',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+service@4.0.4/node_modules/@tarojs/service/dist/Config.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+service@4.0.4/node_modules/@tarojs/service/dist/index.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+service@4.0.4/node_modules/@tarojs/service/index.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/dist/cli.js',
    '/home/project/MiniprogramWorkSpace/circleshop/node_modules/.pnpm/@tarojs+cli@4.0.4/node_modules/@tarojs/cli/bin/taro'
  ]
}
找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
 ELIFECYCLE  Command failed with exit code 1.

期望结果

alpine 初始化后可以正常运行

实际结果

需要安装 @tarojs/binding-linux-x64-musl

环境信息

taro info
👽 Taro v4.0.4

  Taro CLI 4.0.4 environment info:
    System:
      OS: Linux 5.10 Alpine Linux
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.11.1 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.2.4 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.4 => 4.0.4 
      @tarojs/components: 4.0.4 => 4.0.4 
      @tarojs/helper: 4.0.4 => 4.0.4 
      @tarojs/plugin-framework-react: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-alipay: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-h5: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-jd: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-qq: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-swan: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-tt: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-weapp: 4.0.4 => 4.0.4 
      @tarojs/react: 4.0.4 => 4.0.4 
      @tarojs/runtime: 4.0.4 => 4.0.4 
      @tarojs/shared: 4.0.4 => 4.0.4 
      @tarojs/taro: 4.0.4 => 4.0.4 
      @tarojs/vite-runner: 4.0.4 => 4.0.4 
      babel-preset-taro: 4.0.4 => 4.0.4 
      eslint-config-taro: 4.0.4 => 4.0.4
bfrts1fy

bfrts1fy1#

你好,可以尝试把lock文件删除后重新安装依赖试试,如果还无法解决,麻烦提供一下可复现demo

zbsbpyhn

zbsbpyhn2#

@ZEJIA-LIU
创建容器环境 docker run -d --name node-alpine node:18-alpine3.18 tail -f
进入容器环境执行初始化 docker exec -it node-alpine sh

/ $ npm install -g @tarojs/cli
/ $ mkdir /data && cd /data
/data $ taro init
/data # taro init
👽 Taro v4.0.4

node:internal/modules/cjs/loader:1077
  const err = new Error(message);
              ^

Error: Cannot find module '@tarojs/binding-linux-x64-musl'
Require stack:
- /usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/binding/binding.js
- /usr/local/lib/node_modules/@tarojs/cli/dist/create/project.js
- /usr/local/lib/node_modules/@tarojs/cli/dist/presets/commands/init.js
- /usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/utils/index.js
- /usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js
- /usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/index.js
- /usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/index.js
- /usr/local/lib/node_modules/@tarojs/cli/dist/cli.js
- /usr/local/lib/node_modules/@tarojs/cli/bin/taro
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Function.Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/binding/binding.js:175:31)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.newLoader [as .js] (/usr/local/lib/node_modules/@tarojs/cli/node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/binding/binding.js',
    '/usr/local/lib/node_modules/@tarojs/cli/dist/create/project.js',
    '/usr/local/lib/node_modules/@tarojs/cli/dist/presets/commands/init.js',
    '/usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/utils/index.js',
    '/usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js',
    '/usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/index.js',
    '/usr/local/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/index.js',
    '/usr/local/lib/node_modules/@tarojs/cli/dist/cli.js',
    '/usr/local/lib/node_modules/@tarojs/cli/bin/taro'
  ]
}

Node.js v18.18.1

相关问题