【问题标题】:Unable to install gulp-sass on npm version 7.5.1无法在 npm 版本 7.5.1 上安装 gulp-sass
【发布时间】:2021-05-16 07:55:26
【问题描述】:

我正在尝试学习如何将 gulp / sass / 和所有其他工具与 Nodejs 一起使用,但我在安装 gulp-sass 时遇到了问题。我用来安装所有东西的过程是:

  1. 在项目文件夹中启动终端
  2. npm 初始化
  3. npm install gulp -g
  4. npm install gulp --save-dev
  5. npm install gulp-sass

我有一个设置

  • 操作系统 Popos 20.04
  • npm -v 7.5.1
  • 节点-v 15.8.0

错误日志:

npm install gulp-sass --save-dev
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /home/rashy/Sites/gulp/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/bin/node /home/rashy/Sites/gulp/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/usr/bin/node',
npm ERR! gyp verb cli   '/home/rashy/Sites/gulp/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@15.8.0 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/rashy/Sites/gulp/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/rashy/Sites/gulp/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/rashy/Sites/gulp/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:196:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/rashy/Sites/gulp/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/rashy/Sites/gulp/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/rashy/Sites/gulp/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:196:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/rashy/Sites/gulp/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/rashy/Sites/gulp/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/rashy/Sites/gulp/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:196:21)
npm ERR! gyp verb `which` failed  python Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/rashy/Sites/gulp/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/rashy/Sites/gulp/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/rashy/Sites/gulp/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/rashy/Sites/gulp/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:196:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (/home/rashy/Sites/gulp/node_modules/node-gyp/lib/configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/home/rashy/Sites/gulp/node_modules/node-gyp/lib/configure.js:406:16)
npm ERR! gyp ERR! stack     at F (/home/rashy/Sites/gulp/node_modules/which/which.js:68:16)
npm ERR! gyp ERR! stack     at E (/home/rashy/Sites/gulp/node_modules/which/which.js:80:29)
npm ERR! gyp ERR! stack     at /home/rashy/Sites/gulp/node_modules/which/which.js:89:16
npm ERR! gyp ERR! stack     at /home/rashy/Sites/gulp/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack     at /home/rashy/Sites/gulp/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:196:21)
npm ERR! gyp ERR! System Linux 5.8.0-7642-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/rashy/Sites/gulp/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/rashy/Sites/gulp/node_modules/node-sass
npm ERR! gyp ERR! node -v v15.8.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rashy/.npm/_logs/2021-02-12T14_21_23_703Z-debug.log

我已经尝试了所有可用的解决方法。我卸载/重新安装 Nodejs、npm 但这没有帮助。我试图在全球范围内安装 gulp-sass。我还在我的 package.jason 文件和 npm install 中添加了最新版本的 gulp-sass,但每次都会出现上述错误。

有人知道可能是什么问题吗?

提前致谢!

【问题讨论】:

  • 我不知道问题出在哪里,但出于其他原因,您应该尝试gulp-dart-sass 而不是gulp-sass。它是最新的。
  • 这是如何工作的?你不需要 gulp-sass 和 gulp-dart-sass 吗?
  • 不,不需要两者都有。

标签: npm sass gulp gulp-sass


【解决方案1】:

我有同样的问题,对我来说,当我执行npm install node-sass gulp-dart-sass --save-dev时解决了

【讨论】:

    【解决方案2】:

    这解决了我的问题,谢谢

    工作 >> npm install gulp-dart-sass --save-dev
    不工作 >> npm install gulp-sass --save-dev

    https://www.npmjs.com/package/gulp-dart-sass

    【讨论】:

      猜你喜欢
      • 2021-05-07
      • 2016-05-30
      • 2015-10-12
      • 2018-04-02
      • 2018-10-16
      • 2021-08-24
      • 1970-01-01
      • 2019-09-08
      • 2019-03-16
      相关资源
      最近更新 更多