1

我正在 Centos 上安装 Sitespeed.io,但是虽然安装成功,但我遇到了节点模块版本问题。

[root@XXXXXXXXX bin]# ./sitespeed.js https://www.google.com
sleep: using busy loop fallback
internal/modules/cjs/loader.js:718
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '/usr/lib/node_modules/sitespeed.io/node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/lib/node_modules/sitespeed.io/node_modules/sharp/lib/constructor.js:10:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/lib/node_modules/sitespeed.io/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
[root@XXXXXXXX bin]# pwd
/usr/lib/node_modules/sitespeed.io/bin
[root@XXXXXXXX bin]#

我尝试了多种解决方法,例如

  1. 重新安装node和npm
  2. $ rm -rf 节点模块/bcrypt | $ npm 安装
  3. rm package-lock.json | rm -rf 节点模块 | npm 我

还有其他解决方法吗?

我的安装步骤是:

npm install sitespeed.io -g --unsafe-perm   
cd /usr/local/lib/node_modules/sitespeed.io/node_modules/alto-saxophone/
node install.js
4

0 回答 0