yarn add gulp —dev报错

yarn add gulp —dev报错

这是粪坑里找金针菇的感觉吗?

PS E:\Downloads\Compressed\zce-gulp-demo-master> yarn add gulp --dev
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
warning popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
warning gulp-imagemin > imagemin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.     
warning gulp-imagemin > imagemin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning gulp-imagemin > imagemin-optipng > exec-buffer > tempfile > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning gulp-sass > node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning gulp-sass > node-sass > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning gulp-sass > node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning gulp-sass > node-sass > request > har-validator@5.1.5: this library is no longer supported
warning gulp-sass > node-sass > node-gyp > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
warning gulp-swig > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning gulp > glob-watcher > chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning gulp > glob-watcher > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/5] ⠠ gifsicle
[2/5] ⠠ jpegtran-bin
[3/5] ⠠ optipng-bin
[-/5] ⠠ waiting...
error E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\node-sass
Output:
Building: E:\Program Files\nodejs\node.exe E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\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   'E:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\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@18.12.1 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:68:19)    
gyp verb `which` failed     at E (E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:80:29)    
gyp verb `which` failed     at E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:89:16        
gyp verb `which` failed     at E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\isexe\windows.js:36:5       
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:68:19)    
gyp verb `which` failed     at E (E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:80:29)    
gyp verb `which` failed     at E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\which\which.js:89:16        
gyp verb `which` failed     at E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\isexe\windows.js:36:5       
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python E:\Programs\Python\Python311\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: E:\Programs\Python\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:412:12)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "E:\\Program Files\\nodejs\\node.exe" "E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\node-sass
gyp ERR! node -v v18.12.1
                                                                                                                     
                                                                                                                     
                                                                                                                     
                                                                                                                     
warning Error running install script for optional dependency: "E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\gifsicle: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments:
Directory: E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\gifsicle
Output:
‼ getaddrinfo ENOENT raw.githubusercontent.com
  ‼ gifsicle pre-build test failed
  i compiling from source
  × Error: Command failed: F:\\WINDOWS\\system32\\cmd.exe /s /c \"autoreconf -ivf\"
'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���

    at E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\execa\\index.js:231:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)"
info This module is OPTIONAL, you can safely ignore this error
warning Error running install script for optional dependency: "E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\optipng-bin: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments:
Directory: E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\optipng-bin
Output:
‼ getaddrinfo ENOENT raw.githubusercontent.com
  ‼ optipng pre-build test failed
  i compiling from source
  × Error: Command failed: F:\\WINDOWS\\system32\\cmd.exe /s /c \"./configure --with-system-zlib --prefix=\"E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\optipng-bin\\vendor\" --bindir=\"E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\optipng-bin\\vendor\"\"
'.' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���

    at E:\\Downloads\\Compressed\\zce-gulp-demo-master\\node_modules\\execa\\index.js:231:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)"
info This module is OPTIONAL, you can safely ignore this error
PS E:\Downloads\Compressed\zce-gulp-demo-master>

运行一个命令就爆出这么多,还要看哪一步出错了,是不是有种粪坑里找金针菇的感觉,

error E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: E:\Downloads\Compressed\zce-gulp-demo-master\node_modules\node-sass

忽略warning

找到最先的error

可以看到是node-sass出错

搜索可得是node和node-sass不匹配,真日*了狗了,我的node是18,node版本太高还不行吗

找到匹配的版本,然后在配置文件里(比如yarn.lock或者package.json中),把node-sass的版本改成匹配的版本号

重新执行安装

虽然还是有警告,但是还是成功安装了

posted @ 2022-12-18 02:25  胡安  阅读(471)  评论(0编辑  收藏  举报