M2 Macbook 上过时的 NPM 构建帮助

问题描述 投票:0回答:2

我尝试使用节点 20 (npm 10,2,3) 进行构建,但在我的 M2 Macbook 上遇到许多错误。我认为之前的开发人员使用构建机器或过时的虚拟机来进行构建,但他把这个烂摊子留给了我们其他人来解决。

Deprecated notices:

* npm WARN using --force Recommended protections disabled.
* npm WARN old lockfile
* npm WARN old lockfile The package-lock.json file was created with an old version of npm,
* npm WARN old lockfile so supplemental metadata must be fetched from the registry.
* npm WARN old lockfile
* npm WARN old lockfile This is a one-time fix-up, please be patient...
* npm WARN old lockfile
* npm WARN deprecated u/types/[email protected]: This is a stub types definition. svgo provides its own type definitions, so you do not need this installed.
* npm WARN deprecated u/types/[email protected]: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
* npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
* npm WARN deprecated [email protected]: See github.com/lydell/source-map-url#deprecated
* npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-unicode-property-regex instead.
* npm WARN deprecated [email protected]: This module is no longer supported.
* npm WARN deprecated [email protected]: Please see github.com/lydell/urix#deprecated
* npm WARN deprecated [email protected]: Use String.prototype.trim() instead
* npm WARN deprecated [email protected]: this library is no longer supported
* npm WARN deprecated [email protected]: This loader has been deprecated. Please use eslint-webpack-plugin
* npm WARN deprecated [email protected]: github.com/lydell/resolve-url#deprecated
* npm WARN deprecated [email protected]: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at forwardemail.net ; follow/watch github.com/ladjs/consolidate for updates and release changelog
* npm WARN deprecated [email protected]: See github.com/lydell/source-map-resolve#deprecated
* npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
* npm WARN deprecated [email protected]: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
* npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
* npm WARN deprecated [email protected]: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
* npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
* npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
* npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See v8.dev/blog/math-random for details.
* npm WARN deprecated [email protected]: Package no longer supported. Contact Support at www.npmjs.com/support for more info.
* npm WARN deprecated [email protected]: request has been deprecated, see github.com/request/request/issues/3142
* npm WARN deprecated @babel/polyfillu/7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (babeljs.io/docs/en/babel-polyfill) for more information.
* npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
* npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
* npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
* npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

Error Log

* npm ERR! code 1
* npm ERR! path /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass
* npm ERR! command failed
* npm ERR! command sh -c node scripts/build.js
* npm ERR! Building: /usr/local/bin/node /Users/nobodyinparticular77/Code/wpauctions/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/local/bin/node',
* npm ERR! gyp verb cli '/Users/nobodyinparticular77/Code/wpauctions/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 [email protected]
* npm ERR! gyp info using [email protected] | darwin | arm64
* 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` succeeded python2 /Users/nobodyinparticular77/.pyenv/shims/python2
* npm ERR! gyp verb check python version `/Users/nobodyinparticular77/.pyenv/shims/python2 -c "import sys; print "2.7.18
* npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
* npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 20.10.0
* npm ERR! gyp verb command install [ '20.10.0' ]
* npm ERR! gyp verb install input version string "20.10.0"
* npm ERR! gyp verb install installing version: 20.10.0
* npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
* npm ERR! gyp verb install version is already installed, need to check "installVersion"
* npm ERR! gyp verb got "installVersion" 9
* npm ERR! gyp verb needs "installVersion" 9
* npm ERR! gyp verb install version is good
* npm ERR! gyp verb get node dir target node version installed: 20.10.0
* npm ERR! gyp verb build dir attempting to create "build" dir: /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass/build
* npm ERR! gyp verb build dir "build" dir needed to be created? /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass/build
* npm ERR! gyp verb build/config.gypi creating config file
* npm ERR! gyp verb build/config.gypi writing out config file: /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass/build/config.gypi
* npm ERR! gyp verb config.gypi checking for gypi file: /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass/config.gypi
* npm ERR! gyp verb common.gypi checking for gypi file: /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass/common.gypi
* npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
* npm ERR! gyp info spawn /Users/nobodyinparticular77/.pyenv/shims/python2
* npm ERR! gyp info spawn args [
* npm ERR! gyp info spawn args '/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/gyp_main.py',
* npm ERR! gyp info spawn args 'binding.gyp',
* npm ERR! gyp info spawn args '-f',
* npm ERR! gyp info spawn args 'make',
* npm ERR! gyp info spawn args '-I',
* npm ERR! gyp info spawn args '/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass/build/config.gypi',
* npm ERR! gyp info spawn args '-I',
* npm ERR! gyp info spawn args '/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/addon.gypi',
* npm ERR! gyp info spawn args '-I',
* npm ERR! gyp info spawn args '/Users/nobodyinparticular77/.node-gyp/20.10.0/include/node/common.gypi',
* npm ERR! gyp info spawn args '-Dlibrary=shared_library',
* npm ERR! gyp info spawn args '-Dvisibility=default',
* npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/nobodyinparticular77/.node-gyp/20.10.0',
* npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp',
* npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/nobodyinparticular77/.node-gyp/20.10.0/<(target_arch)/node.lib',
* npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass',
* npm ERR! gyp info spawn args '-Dnode_engine=v8',
* npm ERR! gyp info spawn args '--depth=.',
* npm ERR! gyp info spawn args '--no-parallel',
* npm ERR! gyp info spawn args '--generator-output',
* npm ERR! gyp info spawn args 'build',
* npm ERR! gyp info spawn args '-Goutput_dir=.'
* npm ERR! gyp info spawn args ]
* npm ERR! Traceback (most recent call last):
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
* npm ERR! sys.exit(gyp.script_main())
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
* npm ERR! return main(sys.argv[1:])
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
* npm ERR! return gyp_main(args)
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 514, in gyp_main
* npm ERR! options.duplicate_basename_check)
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 130, in Load
* npm ERR! params['parallel'], params['root_targets'])
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2783, in Load
* npm ERR! variables, includes, depth, check, True)
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 399, in LoadTargetBuildFile
* npm ERR! includes, True, check)
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 271, in LoadOneBuildFile
* npm ERR! aux_data, includes, check)
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 308, in LoadBuildFileIncludesIntoDict
* npm ERR! LoadOneBuildFile(include, data, aux_data, None, False, check),
* npm ERR! File "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 251, in LoadOneBuildFile
* npm ERR! None)
* npm ERR! File "/Users/nobodyinparticular77/.node-gyp/20.10.0/include/node/common.gypi", line 1
* npm ERR! nerate ',
* npm ERR! ^
* npm ERR! SyntaxError: EOL while scanning string literal
* npm ERR! gyp ERR! configure error
* npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
* npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/lib/configure.js:345:16)
* npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
* npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
* npm ERR! gyp ERR! System Darwin 23.2.0
* npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/nobodyinparticular77/Code/wpauctions/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
* npm ERR! gyp ERR! cwd /Users/nobodyinparticular77/Code/wpauctions/node_modules/node-sass
* npm ERR! gyp ERR! node -v v20.10.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

我尝试过以下方法:

  1. 降级/升级NPM
  2. 使用Linux VM构建
  3. 将 Python2 侵入我的 M2 Mac
node-sass
2个回答
0
投票

您发布的日志格式很差,但问题是您正在使用

node-sass
,它包装了
libsass
。由于
libsass
是本机二进制文件,因此需要
node-gyp
进行编译,但是由于您使用的是 ARM64 架构的计算机,因此它会失败。

您最好的选择可能是将其替换为

sass
包,它只是 JavaScript 代码,因此不需要重新编译。另请注意,
libsass
以及
node-sass
已被弃用


0
投票

[已解决] 降级到节点 12(通过 nvm)允许其构建。哎呀!

© www.soinside.com 2019 - 2024. All rights reserved.