我试图安装一些需要 Linux 在 WSL 上运行的 magento 店面应用程序。我设法让大多数事情正常工作,但最终我坚持尝试安装依赖项。当它尝试安装 node-sass 时,我收到此错误:
make: Leaving directory '/mnt/c/Github/psp-storefront-magento2/node_modules/node-sass/build'
make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/c/Github/psp-storefront-magento2/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:390:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/home/lursmani/.nvm/versions/node/v16.10.0/bin/node" "/mnt/c/Github/psp-storefront-magento2/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /mnt/c/Github/psp-storefront-magento2/node_modules/node-sass
gyp ERR! node -v v16.10.0
我读到删除yarn.lock并再次安装应该可以解决这个问题,但它对我的情况没有帮助。如果有人知道这里有什么时髦的,我将不胜感激。
最佳答案
我找到了解决方案。显然,GYP 在最新版本的 Node (16) 上存在问题。我必须降级到 Node 14,然后它才能正常工作。
关于magento - 尝试在 WSL 上安装带有 node-sass 的应用程序。获取 "gyp ERR! stack Error: ` make` 失败,退出代码为 : 2",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69483159/