长期使用的前端项目框架发生巨大 Node/NPM 崩溃

Huge Node/NPM crash in long-time used front-end project framework

我有一个 Npm Gulp 框架,现在已经使用了一年多了,但是,自从这周 运行 进行了一些更新后,每个使用它的项目都不再 运行s 我的任何 gulp 命令。

我已经尝试更新全局 gulp,检查了 Node (v10.6.0) 和 NPM (6.1.0) 的版本,并在最后几个小时花在了 Whosebug 和其他在线资源上,但提出了很多建议的解决方案已经尝试并失败了。

Xcode 已安装,命令行工具已安装。

我很困惑是什么导致了这一切,我不期待找到解决方案,但正确方向的一点会非常有帮助。

这是我曾经 运行 npm i.

的踪迹
> fsevents@1.1.2 install /Users/<user>/Development/<project>/node_modules/fsevents
> node install

node-pre-gyp ERR! Tried to download(404):     https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.2/fse-v1.1.2-node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.1.2 and node@10.6.0 (node-v64 ABI) (falling back     to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined):     https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.2/fse-v1.1.2-node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.1.2 and node@10.6.0 (node-v64 ABI) (falling back     to source compile with node-gyp)
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory     '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory     '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory     '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory     '/Library/Developer/CommandLineTools' is a command line tools instance

  SOLINK_MODULE(target) Release/.node
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from In file included from ../fsevents.cc../fsevents.cc::66:
:
In file included from In file included from ../../nan/nan.h../../nan/nan.h::192192:
:
../../nan/nan_maybe_43_inl.h:112../../nan/nan_maybe_43_inl.h::15112:: 15: error: error: no memberno      namedmember  'ForceSet'named  in'ForceSet'  'v8::Object'in
'v8::Object'
  return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
         ~~~  ^
  return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
         ~~~  ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:834:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:849:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:164:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:864:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:157:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:834:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:849:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:164:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:864:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:157:1: note: 'MakeCallback' has been explicitly marked     deIn file included from ../fsevents.cc:6:
../../nan/nan.h:1473:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
precated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../fsevents.cc:6:
../../nan/nan.h:1473:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context)     [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked     deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/<user>/.node-gyp/10.6.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
4 warnings and 1 error generated.
4 warnings and 1 error generated.
make: make: *** [Release/obj.target/fse/fsevents.o] Error 1*** [Release/obj.target/fse/fsevents.o] Error 1

gypgyp  ERR!ERR!  build errorbuild error

gyp ERR! stack Error: `make` failed with exit code: 2
gyp gypERR!  ERR!stack      at ChildProcess.onExit     (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
stackgyp Error: `make` failed with exit code: 2
 gypERR!  ERR!stack      at ChildProcess.emit (events.js:182:13)
stackgyp     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
 gypERR!  ERR!stack      at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! Systemgyp Darwin 16.7.0
 ERR! command "/usr/local/Cellar/node/10.6.0/bin/node"     "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build"     "--module=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.    node" "--module_name=fse"     "--module_path=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64"
gypgyp  ERR! ERR!command  "/usr/local/Cellar/node/10.6.0/bin/node"     "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build"     "--module=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.    node" "--module_name=fse"     "--module_path=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64"
cwd /Users/<user>/Development/<project>/node_modules/fsevents
gyp gyp ERR! ERR!cwd  /Users/<user>/Development/<project>/node_modules/fsevents
node -v v10.6.0
gyp gypERR!  ERR!node -v  v10.6.0
node-gyp -v v3.6.2
gyp gypERR!  ERR!node-gyp -v  v3.6.2
not ok
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/10.6.0/bin/node     /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build     --module=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.    node --module_name=fse     --module_path=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64'     (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous>     (/Users/<user>/Development/<project>/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Darwin 16.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/10.6.0/bin/node"     "/Users/<user>/Development/<project>/node_modules/fsevents/node_modules/.bin/node-pre-gyp" "install"     "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/<user>/Development/<project>/node_modules/fsevents
node-pre-gyp ERR! node -v v10.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/10.6.0/bin/node     /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build     --module=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.    node --module_name=fse     --module_path=/Users/<user>/Development/<project>/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64'     (1)

> uws@9.14.0 install /Users/<user>/Development/<project>/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0


> node-sass@4.9.0 install /Users/<user>/Development/<project>/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/darwin-x64-64_binding.node
Download complete  ⸩ ⠋ :
Binary saved to /Users/<user>/Development/<project>/node_modules/node-sass/vendor/darwin-x64-64/binding.node
Caching binary to /Users/<user>/.npm/node-sass/4.9.0/darwin-x64-64_binding.node

> nunjucks@3.1.3 postinstall /Users/<user>/Development/<project>/node_modules/nunjucks
> node postinstall-build.js src


> node-sass@4.9.0 postinstall /Users/<user>/Development/<project>/node_modules/node-sass
> node scripts/build.js

Binary found at /Users/<user>/Development/<project>/node_modules/node-sass/vendor/darwin-x64-64/binding.node
Testing binary
Binary is fine

> gifsicle@3.0.4 postinstall /Users/<user>/Development/<project>/node_modules/gifsicle
> node lib/install.js

  ✔ gifsicle pre-build test passed successfully

> jpegtran-bin@3.2.0 postinstall /Users/<user>/Development/<project>/node_modules/jpegtran-bin
> node lib/install.js

  ✔ jpegtran pre-build test passed successfully

> optipng-bin@3.1.4 postinstall /Users/<user>/Development/<project>/node_modules/optipng-bin
> node lib/install.js

(node:83110) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners     added. Use emitter.setMaxListeners() to increase limit
  ✔ optipng pre-build test passed successfully
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 2185 packages from 1381 contributors and audited 21717 packages in 48.208s
found 265 vulnerabilities (206 low, 31 moderate, 28 high)
  run `npm audit fix` to fix them, or `npm audit` for details

升级您 package.json 中的 fsevents 版本,该版本似乎不支持您 运行 的 Node.js 版本(版本 10)。

你最好的选择是降级你的节点版本,或者将你的 fsevents 包更新到最新版本 (1.2.4)

祝你好运!

不确定哪里出了问题,但要解决这个问题,我必须使用 sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer.

xcode-select 开发人员目录指向正确的位置

然后我卸载并重新安装了 fsevents 包。我意识到这个错误主要发生在我试图修复上面跟踪底部指出的 found 265 vulnerabilities 时。