【发布时间】:2021-08-11 17:41:44
【问题描述】:
我最近负责管理一个 drupal 8 网站,而我们的组织正在寻找一个永久的 Web 开发人员(即,这不是我通常做的任务)。我目前正在尝试对站点进行一些样式更改,因此我必须使用 grunt、npm 等重建我们的 drupal 主题。
最初我很难让npm install 成功,但发现切换到旧版本的 node/npm (v8.17.0) 会有所帮助。然而,这又带来了一个新问题。当我发出grunt build 时,我看到了这个错误:
> grunt build
Loading "Gruntfile.js" tasks...ERROR
>> Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (57)
>> For more information on which environments are supported please see:
>> https://github.com/sass/node-sass/releases/tag/v3.13.1
Warning: Task "build" not found. Use --force to continue.
Aborted due to warnings.
为了记录,用--force 重新运行没有帮助;进程终止但没有构建。
我注意到较新版本的 node-sass 似乎支持我在我的操作系统(Mac OS 11.5)上运行的节点版本:https://github.com/sass/node-sass/releases/tag/v4.14.1。但我的问题(我认为)是我不确定如何指定我要使用这个版本。
主题的package.json 看起来像这样:
{
"name": "[obscured]",
"version": "1.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-uglify-es": "github:gruntjs/grunt-contrib-uglify#harmony",
"grunt-contrib-watch": "~1.0.0",
"grunt-sass": "^1.0.0",
"grunt-sass-globbing": "^1.3.0",
"md5": "^2.0.0"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"postinstall": "find node_modules/ -name '*.info' -type f -delete"
}
}
我对这些东西不够熟悉,不知道为什么在这里使用node-sass v3.13.1。在我看来,package.json 需要一个 >= 1.0.0 的版本,但在这里我不熟悉肯定会让我退缩;肯定有更多的事情发生。
如果有人可以帮助我强制升级到 node-sass v.4.14.1 或建议另一种方法来解决我在 grunt build 中看到的运行时错误,我将不胜感激。
【问题讨论】:
标签: node.js gruntjs npm-install node-sass