node.js - SyntaxHighlighter 的 npm 构建问题

标签 node.js npm build syntaxhighlighter

我是 npm 的初学者,正在尝试通过首先使用 git 克隆它来构建 SyntaxHighlighter 版本 4,但失败了。这是我得到的错误:

1 error generated.
make: *** [Release/obj.target/binding/src/create_string.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/name/syntaxhighlighter/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/Users/name/syntaxhighlighter/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/name/syntaxhighlighter/node_modules/node-sass
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN notsup Unsupported engine for karma@0.13.22: wanted: {"node":"0.10 || 0.12 || 4 || 5"} (current: {"node":"12.16.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: karma@0.13.22
npm WARN syntaxhighlighter@4.0.1 No description

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/name/.npm/_logs/2020-04-05T02_52_17_048Z-debug.log

最佳答案

您遇到的问题是 SyntaxHighlighter 版本 4 太旧,并且您正在运行的 Node 版本不支持它的依赖项。

错误来自的包是 Karma。尝试安装的 Karma 版本是 v0.13.22。该版本的 Karma 仅支持最大 Node 版本 5,而您似乎运行的是版本 12。

您可以通过降级 Node 版本或使用 Node Version Manager (NVM) 等工具临时降级 Node 版本来解决此问题。

NVM

关于node.js - SyntaxHighlighter 的 npm 构建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61037449/

相关文章:

node.js - mocha,用于 nodejs 中的 post 的 chai 测试

javascript - 更改局部变量的值执行原始全局变量值的更改

node.js - 为什么 rxjs 一直不是正确的版本?

angularjs - 是否有 Angular 2 的官方 nuget 包?

npm - 如何将 monorepo 中的所有子文件夹 package.json 更新为相同版本?

javascript - Vue.js 模块构建

javascript - 为什么 node.js 会忽略 package.json 文件中的 "type"设置?

node.js - 远程 Node.js 解释器 PhpStorm

java - maven 构建过程在隔离的虚拟机中失败

node.js - `gulp` 进程完成后批处理脚本停止执行,不继续执行脚本的其余部分