最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】Mac中npm安装gitbook报错:fsevents@0.3.8 node-gyp rebuild define NAN_DEPRECATED __attribute__ deprecated

Mac crifan 153浏览 0评论
折腾:
【未解决】Mac已安装gitbook-cli去gitbook查看版本号时一直卡死在Installing GitBook 3.2.3
期间,去用:
npm --registry https://registry.npm.taobao.org install -g gitbook
安装gitbook,最后报错:
完整log
~  npm --registry https://registry.npm.taobao.org install -g gitbook

npm WARN deprecated graceful-fs@3.0.5: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated chokidar@1.0.6: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated nunjucks@2.2.0: potential XSS vulnerability in autoescape mode, and with escape filter was fixed in v2.4.3
npm WARN deprecated fsevents@0.3.8: "Please update to latest v2.3 or v2.2"
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated highlight.js@8.8.0: Version no longer supported. Upgrade to @latest
npm WARN deprecated sprintf@0.1.5: The sprintf package is deprecated in favor of sprintf-js.
npm WARN deprecated datauri@0.2.1: Datauri 2.0 released. See more in https://github.com/data-uri/datauri/releases/tag/v2.0.0
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated hawk@1.1.1: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated boom@0.4.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@0.9.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated sntp@0.2.4: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated cryptiles@0.2.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
/usr/local/bin/gitbook -> /usr/local/lib/node_modules/gitbook/bin/gitbook.js


> fsevents@0.3.8 install /usr/local/lib/node_modules/gitbook/node_modules/fsevents
> node-gyp rebuild


  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:85:
../src/methods.cc:14:12: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  handler->Call(3, argv);
           ^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node
+ gitbook@2.6.9
added 407 packages from 577 contributors in 368.296s
结果是报错了。
npm fsevents node-gyp rebuild define NAN_DEPRECATED __attribute__ deprecated
npm fsevents SOLINK_MODULE(target) Release/.node
Installation fails at ‘npm install’ step · Issue #9 · neoighodaro-articles/trello-clone-vue-laravel
fsevents fails to build · Issue #226 · fsevents/fsevents
npm install error · Issue #178 · microsoft/TypeScript-Node-Starter
Node: 12.2.0 throws error during npm install · Issue #278 · fsevents/fsevents
 xxx@x  ~  which gitbook
/usr/local/bin/gitbook
 xxx@x  ~  gitbook --version
You need to install "gitbook-cli" to have access to the gitbook command anywhere on your system.
If you've installed this package globally, you need to uninstall it.
>> Run "npm uninstall -g gitbook" then "npm install -g gitbook-cli"
之前其实是已经安装了
gitbook-cli
的,但是不知何故,没了?
再去:
npm install -g gitbook-cli
node.js – Why am I getting these failures when trying to run npm install for an Angular project on macOS Catalina? – Stack Overflow
node.js – Can’t install fsevents on MacOS – Stack Overflow
 ~  npm install -g gitbook-cli
npm WARN rm not removing /usr/local/bin/gitbook as it wasn't installed by /usr/local/lib/node_modules/gitbook-cli
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/gitbook-cli/bin/gitbook.js
npm ERR! dest /usr/local/bin/gitbook
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/gitbook-cli/bin/gitbook.js' -> '/usr/local/bin/gitbook'
npm ERR! File exists: /usr/local/bin/gitbook
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.


npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxx/.npm/_logs/2021-01-22T14_34_03_688Z-debug.log
算了,去删除掉:
不过先看看:
  ll /usr/local/bin/gitbook
lrwxr-xr-x  1 xxx  admin    42B  1 22 22:28 /usr/local/bin/gitbook -> ../lib/node_modules/gitbook/bin/gitbook.js
是软链接
 xxx@xx  ~  ll /usr/local/lib/node_modules/gitbook/bin/gitbook.js
-rwxr-xr-x  1 xxx  admin   374B 10 10  2018 /usr/local/lib/node_modules/gitbook/bin/gitbook.js
 xxx@xx  ~  ll /usr/local/lib/node_modules/gitbook/
total 552
-rw-r--r--    1 xxx  admin   1.3K 10 10  2018 AUTHORS.md
-rw-r--r--    1 xxx  admin    10K 10 10  2018 CHANGES.md
-rw-r--r--    1 xxx  admin    11K 10 10  2018 LICENSE
-rw-r--r--    1 xxx  admin   7.7K 10 10  2018 README.md
-rw-r--r--    1 xxx  admin   657B 10 10  2018 appveyor.yml
drwxr-xr-x    3 xxx  admin    96B  1 22 22:27 bin
-rw-r--r--    1 xxx  admin   1.3K 10 10  2018 gulpfile.js
drwxr-xr-x   16 xxx  admin   512B  1 22 22:27 lib
drwxr-xr-x  236 xxx  admin   7.4K  1 22 22:28 node_modules
-rw-r--r--    1 xxx  admin   3.1K  1 22 22:28 package.json
-rw-r--r--    1 xxx  admin   227K 10 10  2018 preview.png
drwxr-xr-x   26 xxx  admin   832B  1 22 22:27 test
drwxr-xr-x    7 xxx  admin   224B  1 22 22:27 theme
还是删除掉吧
rm -rf /usr/local/lib/node_modules/gitbook/
然后重新安装
~  npm install -g gitbook-cli
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/gitbook-cli/bin/gitbook.js
npm ERR! dest /usr/local/bin/gitbook
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/gitbook-cli/bin/gitbook.js' -> '/usr/local/bin/gitbook'
npm ERR! File exists: /usr/local/bin/gitbook
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxx/.npm/_logs/2021-01-22T14_37_04_081Z-debug.log
去删除:
rm -rf /usr/local/bin/gitbook
再重新安装
~  npm install -g gitbook-cli
/usr/local/bin/gitbook -> /usr/local/lib/node_modules/gitbook-cli/bin/gitbook.js
+ gitbook-cli@2.3.2
added 578 packages from 672 contributors in 28.167s
然后:
 ~  gitbook -V
CLI version: 2.3.2
Installing GitBook 3.2.3
还是触发了继续安装gitbook
gitbook-cli Installing GitBook 3.2.3
Mac安装gitbook,卡在Installing GitBook 3.2.3 – 简书
Gitbook install/init fails · Issue #74 · GitbookIO/gitbook-cli
安装gitbook-cli时提示Installing GitBook 3.2.3 – MelodyJerry – 博客园
gitbook的安装与使用 – osc_63i522q0的个人空间 – OSCHINA – 中文开源技术交流社区
Linux or Mac 安装 gitbook 3.2.3 失败解决方案 | 偕臧
看来是低版本的node,比如此处的v10.23,是可以用的。
只不过对于:
Installing GitBook 3.2.3
要继续等待,直到完成。
那就放着等待吧
等了一夜(足够长时间后),还是卡死
放弃了
还是再去试试:
npm install -g gitbook
估计还会和之前一样错误
去加上版本号试试:
npm install -g gitbook@3.2.3
看输出:
~  npm install -g gitbook@3.2.3
npm WARN deprecated chokidar@1.5.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated ignore@3.1.2: several bugs fixed in v3.2.1
⸨░░░░░░░░░░░░░░░░░░⸩ ⠼ fetchMetadata: sill resolveWithNewModule domelementtype@1.1.3 checking installable status
貌似就和之前,出错时比,少了很多警告,或许后续能顺利安装
且此处到了:
fsevents
和之前的出错的:
> fsevents@0.3.8 install /usr/local/lib/node_modules/gitbook/node_modules/fsevents
比,现在版本号更新了:
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
感觉可以正常安装
此处过了fsevents了。
注意到一个细节:
npm WARN deprecated chokidar@1.5.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
。。。
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
怎么同一个插件,还安装了2个不同版本?
fetch后,进入extract了,进度条进步很快
接着进去:
node install.js
最后完成了,完整log:
~  npm install -g gitbook@3.2.3
npm WARN deprecated chokidar@1.5.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated ignore@3.1.2: several bugs fixed in v3.2.1
npm WARN deprecated har-validator@2.0.6: this library is no longer supported
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
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 highlight.js@9.2.0: Version no longer supported. Upgrade to @latest
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated datauri@0.2.1: Datauri 2.0 released. See more in https://github.com/data-uri/datauri/releases/tag/v2.0.0
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
/usr/local/bin/gitbook -> /usr/local/lib/node_modules/gitbook/bin/gitbook.js


> fsevents@1.2.13 install /usr/local/lib/node_modules/gitbook/node_modules/fsevents
> node install.js


  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
+ gitbook@3.2.3
added 757 packages from 1016 contributors in 350.848s
【总结】
此处Mac中,已重新安装了版本相对低的node:
 node --version
v10.23.1
 npm --version
6.14.10
然后之前去:
npm --registry https://registry.npm.taobao.org install -g gitbook
最后会出现(之前误判以为错误,后来发现是)警告:
> fsevents@0.3.8 install /usr/local/lib/node_modules/gitbook/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:85:
../src/methods.cc:14:12: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  handler->Call(3, argv);
           ^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.

解决办法:无需解决。只是警告而已。且gitbook已安装了。

只不过,从:
+ gitbook@2.6.9
added 407 packages from 577 contributors in 368.296s
看出:gitbook安装的版本是:2.6.9
不是我们希望的,最新的可用的:3.2.3

如何才能安装最新的3.2.3的gitbook?
答:经过折腾,是:
npm install -g gitbook@3.2.3
即可。
不过后续又出现:
【未解决】Mac中已安装gitbook和gitbook-cli但还是报错:Run npm uninstall -g gitbook then npm install -g gitbook-cli

转载请注明:在路上 » 【已解决】Mac中npm安装gitbook报错:fsevents@0.3.8 node-gyp rebuild define NAN_DEPRECATED __attribute__ deprecated

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
19 queries in 0.077 seconds, using 9.37MB memory