微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

安装 Strapi 时 SQLite3 出现问题 - 无法在类似字节的对象上使用字符串模式

如何解决安装 Strapi 时 SQLite3 出现问题 - 无法在类似字节的对象上使用字符串模式

我在 M1 Mac 上使用节点 14.17.1,我尝试用纱线安装 Strapi。执行 create strapi-app 后,它产生了这个错误

Oh,it seems that you encountered errors while installing dependencies in your project.
Don't give up,your project was created correctly.
Fix the issues mentioned in the installation errors and try to run the following command:

cd /Users/michelletan/Desktop/test && yarn install

error Command Failed.

所以我做了cd /Users/michelletan/Desktop/test && yarn install,但现在错误是:

yarn install v1.22.10
warning ../../package.json: No license field
info No lockfile found.
[1/5] ?  Validating package.json...
[2/5] ?  Resolving packages...
warning strapi > boom@7.3.0: This module has moved and is Now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
warning strapi > koa-ip > debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
warning strapi > boom > hoek@6.1.3: This module has moved and is Now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
warning strapi > koa-session > 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 strapi > strapi-generate-new > 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 strapi-admin > @babel/polyfill@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 (https://babeljs.io/docs/en/babel-polyfill) for more information.
warning strapi-admin > html-webpack-plugin@3.2.0: 3.x is no longer supported
warning strapi-admin > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning strapi-admin > webpack-dev-server > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and Could be using insecure binaries. Upgrade to fsevents 2.
warning strapi-admin > @babel/polyfill > core-js@2.6.12: core-js@<3.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. Please,upgrade your dependencies to the actual version of core-js.
warning strapi-admin > react-intl > @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat
warning strapi-admin > react-intl > intl-messageformat-parser@5.5.1: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
warning strapi-admin > webpack-dev-server > sockjs > 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 strapi-admin > webpack-dev-server > webpack-log > 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 strapi-admin > react-intl > intl-messageformat > intl-messageformat-parser@5.5.1: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
warning strapi-admin > reactstrap > react-popper > popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core,this package is dedicated to the legacy v1
warning strapi-admin > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning strapi-admin > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning strapi-admin > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning strapi-plugin-users-permissions > 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 strapi-plugin-users-permissions > request@2.88.2: request has been deprecated,see https://github.com/request/request/issues/3142
warning strapi-plugin-users-permissions > 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 strapi-plugin-users-permissions > request > har-validator@5.1.5: this library is no longer supported
warning strapi-plugin-users-permissions > koa2-ratelimit > sequelize > 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 strapi-plugin-email > strapi-provider-email-sendmail > sendmail > mailcomposer@3.12.0: This project is unmaintained
warning strapi-plugin-email > strapi-provider-email-sendmail > sendmail > mailcomposer > buildmail@3.10.0: This project is unmaintained
warning strapi-plugin-upload > 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 sqlite3 > node-gyp > request@2.88.2: request has been deprecated,see https://github.com/request/request/issues/3142
warning sqlite3 > node-pre-gyp@0.11.0: Please upgrade to @mapBox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapBox scoped package will recieve updates in the future
warning strapi-plugin-graphql > graphql-tools > 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.
[3/5] ?  Fetching packages...
[4/5] ?  Linking dependencies...
warning "strapi-admin > @buffetjs/utils@3.3.6" has incorrect peer dependency "yup@^0.27.0".
warning "strapi-admin > bootstrap@4.6.0" has unmet peer dependency "jquery@1.9.1 - 3".
warning "strapi-admin > bootstrap@4.6.0" has unmet peer dependency "popper.js@^1.16.1".
warning "strapi-plugin-users-permissions > grant-koa@5.4.8" has unmet peer dependency "koa@>=2.0.0".
warning "strapi-plugin-graphql > graphql-iso-date@3.6.1" has incorrect peer dependency "graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "strapi-plugin-graphql > graphql-playground-middleware-koa@1.6.21" has unmet peer dependency "koa@^2".
warning "strapi-plugin-graphql > graphql-type-long@0.1.1" has incorrect peer dependency "graphql@^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0".
[5/5] ?  Building fresh packages...
[-/14] ⢀ waiting...
[8/14] ⢀ sqlite3
[7/14] ⢀ sharp
[-/14] ⢀ waiting...
error /Users/michelletan/Desktop/test/node_modules/sqlite3: Command Failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /Users/michelletan/Desktop/test/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.11.0
node-pre-gyp info using node@14.17.1 | darwin | arm64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for "/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapBox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-darwin-arm64.tar.gz
node-pre-gyp http 403 https://mapBox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-darwin-arm64.tar.gz
node-pre-gyp WARN Tried to download(403): https://mapBox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-darwin-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.0 and node@14.17.1 (node-v83 ABI,unkNown) (falling back to source compile with node-gyp) 
node-pre-gyp http 403 status code downloading tarball https://mapBox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-darwin-arm64.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@14.17.1 | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@14.17.1 | darwin | arm64
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args   '/Users/michelletan/Desktop/test/node_modules/node-gyp/gyp/gyp_main.py',gyp info spawn args   'binding.gyp',gyp info spawn args   '-f',gyp info spawn args   'make',gyp info spawn args   '-I',gyp info spawn args   '/Users/michelletan/Desktop/test/node_modules/sqlite3/build/config.gypi',gyp info spawn args   '/Users/michelletan/Desktop/test/node_modules/node-gyp/addon.gypi',gyp info spawn args   '/Users/michelletan/.node-gyp/14.17.1/include/node/common.gypi',gyp info spawn args   '-Dlibrary=shared_library',gyp info spawn args   '-Dvisibility=default',gyp info spawn args   '-Dnode_root_dir=/Users/michelletan/.node-gyp/14.17.1',gyp info spawn args   '-Dnode_gyp_dir=/Users/michelletan/Desktop/test/node_modules/node-gyp',gyp info spawn args   '-Dnode_lib_file=/Users/michelletan/.node-gyp/14.17.1/<(target_arch)/node.lib',gyp info spawn args   '-Dmodule_root_dir=/Users/michelletan/Desktop/test/node_modules/sqlite3',gyp info spawn args   '-Dnode_engine=v8',gyp info spawn args   '--depth=.',gyp info spawn args   '--no-parallel',gyp info spawn args   '--generator-output',gyp info spawn args   'build',gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@14.17.1 | darwin | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release','-C','build' ]
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  LIBTOOL-STATIC Release/nothing.a
Traceback (most recent call last):
  File "/Users/michelletan/Desktop/test/node_modules/sqlite3/build/./gyp-mac-tool",line 611,in <module>
    sys.exit(main(sys.argv[1:]))
  File "/Users/michelletan/Desktop/test/node_modules/sqlite3/build/./gyp-mac-tool",line 28,in main
    exit_code = executor.dispatch(args)
  File "/Users/michelletan/Desktop/test/node_modules/sqlite3/build/./gyp-mac-tool",line 43,in dispatch
    return getattr(self,method)(*args[1:])
  File "/Users/michelletan/Desktop/test/node_modules/sqlite3/build/./gyp-mac-tool",line 246,in ExecFilterLibtool
    if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make: *** [Release/nothing.a] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` Failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/michelletan/Desktop/test/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:375:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/opt/homebrew/Cellar/node@14/14.17.1/bin/node" "/Users/michelletan/Desktop/test/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /Users/michelletan/Desktop/test/node_modules/sqlite3
gyp ERR! node -v v14.17.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node@14/14.17.1/bin/node /Users/michelletan/Desktop/test/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/michelletan/Desktop/test/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:375:28)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1055:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 20.3.0
node-pre-gyp ERR! command "/opt/homebrew/Cellar/node@14/14.17.1/bin/node" "/Users/michelletan/Desktop/test/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/michelletan/Desktop/test/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.17.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/opt/homebrew/Cellar/node@14/14.17.1/bin/node /Users/michelletan/Desktop/test/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/michelletan/Desktop/test/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64

我以为是 sqlite3 的问题,发现一些帖子说你应该使用 5.0.0 版而不是最新版,但我检查了 package.json,它已经在使用 5.0.0。

编辑:TypeError: cannot use a string pattern on a bytes-like object 正如乔纳森指出的那样,这可能是一个问题。我该怎么办?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。