目录

Cannot find module @rollup/rollup-win32-x64-msvc

方法1

在package.json中添加postinstall:

shell 复制代码
"scripts": {
    "postinstall": "node -e \"const { platform } = process; if (platform === 'win32') {  require('child_process').execSync('npm install @rollup/rollup-win32-x64-msvc', { stdio: 'inherit' }); } else if (platform === 'linux') { require('child_process').execSync('npm install @rollup/rollup-linux-x64-musl', { stdio: 'inherit' }); } else if (platform === 'darwin') {require('child_process').execSync('npm install @rollup/rollup-darwin-x64', { stdio: 'inherit' }); } else { console.log('Unsupported platform:', platform); }\""
  },

方法2

在package.json中添加optionalDependencies:

json 复制代码
"optionalDependencies": {
    "@rollup/rollup-win32-x64-msvc": "4.36.0",
    "@rollup/rollup-win32-arm64-msvc": "4.36.0",
    "@rollup/rollup-win32-ia32-msvc": "4.36.0",

    "@rollup/rollup-darwin-x64": "4.36.0",
    "@rollup/rollup-darwin-arm64": "4.36.0",

    "@rollup/rollup-linux-x64-gnu": "4.36.0",
    "@rollup/rollup-linux-x64-musl": "4.36.0",
    "@rollup/rollup-linux-arm-gnueabihf": "4.36.0",
    "@rollup/rollup-linux-arm-musleabihf": "4.36.0",
    "@rollup/rollup-linux-arm64-gnu": "4.36.0",
    "@rollup/rollup-linux-arm64-musl": "4.36.0",
    "@rollup/rollup-linux-loongarch64-gnu": "4.36.0",
    "@rollup/rollup-linux-powerpc64le-gnu": "4.36.0",
    "@rollup/rollup-linux-riscv64-gnu": "4.36.0",
    "@rollup/rollup-linux-s390x-gnu": "4.36.0"
  },

方法3

在package-lock.json中添加对应的包和版本:

json 复制代码
"node_modules/@rollup/rollup-darwin-arm64": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.36.0.tgz",
      "integrity": "sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "darwin"
      ]
    },
    "node_modules/@rollup/rollup-darwin-x64": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.36.0.tgz",
      "integrity": "sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "darwin"
      ]
    },
    "node_modules/@rollup/rollup-linux-arm64-gnu": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.36.0.tgz",
      "integrity": "sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@rollup/rollup-linux-arm64-musl": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.36.0.tgz",
      "integrity": "sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@rollup/rollup-linux-x64-gnu": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.36.0.tgz",
      "integrity": "sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@rollup/rollup-linux-x64-musl": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.36.0.tgz",
      "integrity": "sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "linux"
      ]
    },
    "node_modules/@rollup/rollup-win32-arm64-msvc": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.36.0.tgz",
      "integrity": "sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "win32"
      ]
    },
    "node_modules/@rollup/rollup-win32-x64-msvc": {
      "version": "4.36.0",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.36.0.tgz",
      "integrity": "sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "optional": true,
      "os": [
        "win32"
      ]
    },

环境

shell 复制代码
C:\workspace\app-ems-global-admin\app>node -v
v22.13.0

C:\workspace\app-ems-global-admin\app>npm -v
10.9.2
本文是转载文章,点击查看原文
如有侵权,请联系 xyy@jishuzhan.net 删除
相关推荐
trust Tomorrow6 分钟前
JavaScript案例0322
javascript
胡桃夹夹子37 分钟前
uniapp自身bug | uniapp+vue3打包后 index.html无法直接运行
javascript·uni-app·bug
fridayCodeFly38 分钟前
:class=“{ ‘addCheckstyle‘: hasError }“这是什么意思
前端·javascript·vue.js
lee5761 小时前
用Promise实现ajax的自动重试
前端·javascript·ajax
风尚云网1 小时前
风尚云网|前端|JavaScript性能优化实战:从瓶颈定位到高效执行
前端·javascript·学习·html
王小菲2 小时前
回顾JavaScript执行上下文、作用域链与闭包
前端·javascript·面试
前端Hardy2 小时前
HTML&CSS:必学!跳跃的动态标题
javascript·css·html
前端Hardy2 小时前
HTML&CSS:速看!手把手教你实现超酷的动态滑动卡片(建议收藏)
javascript·css·html
狠狠的学习3 小时前
遇到输入自动保存,我是这样做的
前端·javascript
火龙谷3 小时前
【nodejs】爬虫路漫漫,关于nodejs的基操
开发语言·javascript