Closed bennycode closed 1 year ago
I'm confused about node-gyp error cause I want to reinstall Hexo-renderer-sass. but even when I specified the version to 6.0.0, error occurs.
npm install --save-dev hexo-renderer-sass@6.0.0 npm ERR! code ETARGET npm ERR! notarget No matching version found for hexo-renderer-sass@6.0.0. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.
There is an error cause I want to install hexo-renderer-sass.
node : v16.6.1
npm : v7.20.3
hexo : 5.4.0
hexo-cli : 4.3.0
node-sass : 6.0.1
node-gyp: 8.1.0
Building: /home/kirisame/.nvm/versions/node/v16.6.1/bin/node /mnt/d/hexo/node_modules/_node-gyp@3.8.0@node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/home/kirisame/.nvm/versions/node/v16.6.1/bin/node',
gyp verb cli '/mnt/d/hexo/node_modules/_node-gyp@3.8.0@node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@16.6.1 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
......
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/d/hexo/node_modules/_node-gyp@3.8.0@node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:394:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
gyp ERR! command "/home/kirisame/.nvm/versions/node/v16.6.1/bin/node" "/mnt/d/hexo/node_modules/_node-gyp@3.8.0@node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /mnt/d/hexo/node_modules/_node-sass@4.14.1@node-sass
gyp ERR! node -v v16.6.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
[npminstall:runscript:error] hexo-renderer-sass@0.4.0 › node-sass@^4.5.3 scripts.postinstall run "node scripts/build.js" error: Error [RunScriptError]: Run "sh -c node scripts/build.js" error, exit code 1
at ChildProcess.<anonymous> (/home/kirisame/.nvm/versions/node/v16.6.1/lib/node_modules/cnpm/node_modules/runscript/index.js:96:21)
at ChildProcess.emit (node:events:394:28)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
stdio: [Object],
exitcode: 1
}
✖ Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "sh -c node scripts/build.js" error, exit code 1
RunScriptError: Run "sh -c node scripts/build.js" error, exit code 1
at ChildProcess.<anonymous> (/home/kirisame/.nvm/versions/node/v16.6.1/lib/node_modules/cnpm/node_modules/runscript/index.js:96:21)
at ChildProcess.emit (node:events:394:28)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npminstall version: 5.0.1
npminstall args: /home/kirisame/.nvm/versions/node/v16.6.1/bin/node /home/kirisame/.nvm/versions/node/v16.6.1/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/home/kirisame/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.nlark.com hexo-renderer-sass
I have tried bennycode's method , but it doesn't work. It will use specify version if I running "npm install hexo-renderer-sass".
Remove your node_modules folder, and modify the package.json
"hexo-renderer-sass": "github:cocowool/hexo-renderer-sass",
then npm install
@cocowool Watch your tutorial on your website, it really helps. Thanks!
I've opened PR #46 that will fix this, but I'd need @knksmith57 to merge to fix the issue.
As @robincafolla mentioned above, this issue is fixed in #46, closing.
The "hexo-renderer-sass" package uses an old version of "node-sass" which is based on the very old "node-gyp" v3.8.0.
Node-gyp v3.8.0 uses Python 2 which reached end of life and the old "node-sass" does not support Node v16.
Please update "node-sass" to v6 in order to support Node v16 and a more recent version of node-gyp which works with Python 3.
References: