FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.88k stars 137 forks source link

Can't install SQLite3 #586

Closed sinclairnick closed 4 years ago

sinclairnick commented 4 years ago

Creation of a new FoalTS project using foal create app app does not successfully complete. I run into the following error:

📂 Creating files...

  📦 Installing the dependencies...
yarn install v1.10.1
warning package.json: No license field
info No lockfile found.
warning app@0.0.0: No license field
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
warning supertest > superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header).  This notice will go away with v5.0.2+ once it is released.
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 📃  Building fresh packages...
error /Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /Users/Nick/Documents/coding/grossr_v3/api/app/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@13.3.0 | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for "/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.0/node-v79-darwin-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.0/node-v79-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.0/node-v79-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.1.0 and node@13.3.0 (node-v79 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/v4.1.0/node-v79-darwin-x64.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@13.3.0 | darwin | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@13.3.0 | darwin | x64
gyp info find Python using Python version 3.6.4 found at "/Users/Nick/anaconda3/bin/python"
gyp info spawn /Users/Nick/anaconda3/bin/python
gyp info spawn args [
gyp info spawn args   '/usr/local/lib/node_modules/npm/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/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/Nick/Library/Caches/node-gyp/13.3.0/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/Nick/Library/Caches/node-gyp/13.3.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/Nick/Library/Caches/node-gyp/13.3.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/Nick/Documents/coding/grossr_v3/api/app/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 ]
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2215, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 794, in Write
    extra_mac_bundle_resources, part_of_all)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 900, in WriteActions
    env = self.GetSortedXcodeEnv()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1885, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1616, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1527, in _GetXcodeEnv
    if XcodeVersion() >= '0500' and not env.get('SDKROOT'):
TypeError: '>=' not supported between instances of 'tuple' and 'str'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:219:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79"
gyp ERR! cwd /Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3
gyp ERR! node -v v13.3.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:219:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1027:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:5)
node-pre-gyp ERR! System Darwin 19.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3
node-pre-gyp ERR! node -v v13.3.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/Nick/Documents/coding/grossr_v3/api/app/node_modules/sqlite3/lib/binding/node-v79-darwin-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
A problem occurred when installing the dependencies. See above.
  📔 Initializing git repository...
     Directory is already under version control. Skipping initialization of git.

  👉 Run the following commands to get started:

    $ cd app
    $ npm run develop

I have tried updating node, yarn, npm and node-gyp to no avail.

edit: I am using postgres anyway, so I think it would be a good idea to implement a database CLI option to specify, or alternatively have no default. This problem with sqlite is documented here

sinclairnick commented 4 years ago

UPDATE: I downgraded my Node version to 12.0 using the n package and it seems to work now.

LoicPoullain commented 4 years ago

Thanks for the update. :+1: It looks like the issue is fixed now. Can we close this?