折腾:
【未解决】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 [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: potential XSS vulnerability in autoescape mode, and with escape filter was fixed in v2.4.3 npm WARN deprecated [email protected]: "Please update to latest v2.3 or v2.2" npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Version no longer supported. Upgrade to @latest npm WARN deprecated [email protected]: The sprintf package is deprecated in favor of sprintf-js. npm WARN deprecated [email protected]: Datauri 2.0 released. See more in https://github.com/data-uri/datauri/releases/tag/v2.0.0 npm WARN deprecated [email protected]: Use uuid module instead npm WARN deprecated [email protected]: 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 [email protected]: 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 [email protected]: 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 [email protected]: 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 [email protected]: 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 > [email protected] 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 + [email protected] 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
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
~ 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 + [email protected] 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
看来是低版本的node,比如此处的v10.23,是可以用的。
只不过对于:
Installing GitBook 3.2.3
要继续等待,直到完成。
那就放着等待吧
等了一夜(足够长时间后),还是卡死
放弃了
还是再去试试:
npm install -g gitbook
估计还会和之前一样错误
去加上版本号试试:
npm install -g [email protected]
看输出:
~ npm install -g [email protected] npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: several bugs fixed in v3.2.1 ⸨░░░░░░░░░░░░░░░░░░⸩ ⠼ fetchMetadata: sill resolveWithNewModule [email protected] checking installable status
貌似就和之前,出错时比,少了很多警告,或许后续能顺利安装
且此处到了:
fsevents
和之前的出错的:
> [email protected] install /usr/local/lib/node_modules/gitbook/node_modules/fsevents
比,现在版本号更新了:
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
感觉可以正常安装
此处过了fsevents了。
注意到一个细节:
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. 。。。 npm WARN deprecated [email protected]: 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 [email protected] npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: several bugs fixed in v3.2.1 npm WARN deprecated [email protected]: this library is no longer supported npm WARN deprecated [email protected]: 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 [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130 npm WARN deprecated [email protected]: Use uuid module instead npm WARN deprecated [email protected]: 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 [email protected]: 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 [email protected]: 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 [email protected]: 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 [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN deprecated [email protected]: Version no longer supported. Upgrade to @latest npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead npm WARN deprecated [email protected]: Datauri 2.0 released. See more in https://github.com/data-uri/datauri/releases/tag/v2.0.0 npm WARN deprecated [email protected]: 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 > [email protected] 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 + [email protected] 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
最后会出现(之前误判以为错误,后来发现是)警告:
> [email protected] 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已安装了。
只不过,从:
+ [email protected] added 407 packages from 577 contributors in 368.296s
看出:gitbook安装的版本是:2.6.9
不是我们希望的,最新的可用的:3.2.3
如何才能安装最新的3.2.3的gitbook?
答:经过折腾,是:
npm install -g [email protected]
即可。
不过后续又出现:
【未解决】Mac中已安装gitbook和gitbook-cli但还是报错:Run npm uninstall -g gitbook then npm install -g gitbook-cli
转载请注明:在路上 » 【已解决】Mac中npm安装gitbook报错:[email protected] node-gyp rebuild define NAN_DEPRECATED __attribute__ deprecated