w3tecch / express-typescript-boilerplate

A delightful way to building a RESTful API with NodeJs & TypeScript by @w3tecch
MIT License
3.29k stars 903 forks source link

Git clone this repo, and yarn install gives errors #212

Open rafeyhusain-bt opened 4 years ago

rafeyhusain-bt commented 4 years ago

When I git clone and run yarn install, I get lots of warnings and Errors!

error D:\data\github\express-typescript-boilerplate\node_modules\sqlite3: Command failed.
Exit code: 1
node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.0.4 and node@12.18.3 (node-v72 ABI, unknown) (falling back 
to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu 
or right-click the solution, and then selecting "Retarget solution". [D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build\deps\action_before_build.vcxproj]

Here is the full log

PS D:\data\github\express-typescript-boilerplate> yarn install

yarn install v1.22.4 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info fsevents@1.2.4: The platform "win32" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... warning " > class-validator-jsonschema@1.3.0" has unmet peer dependency "class-transformer@^0.2.3". warning " > express-graphql@0.6.12" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0". warning "express-status-monitor > request-promise-native@1.0.5" has unmet peer dependency "request@^2.34". warning "express-status-monitor > request-promise-native > request-promise-core@1.1.1" has unmet peer dependency "request@^2.34". warning " > typeorm-typedi-extensions@0.2.1" has incorrect peer dependency "typedi@^0.7.2". [5/5] Building fresh packages... [1/3] ⠄ bcrypt [2/3] ⠄ nodemon error D:\data\github\express-typescript-boilerplate\node_modules\sqlite3: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments: Directory: D:\data\github\express-typescript-boilerplate\node_modules\sqlite3 Output: node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@0.10.3 node-pre-gyp info using node@12.18.3 | win32 | x64 node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp info check checked for "D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node" (not found) node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.4/node-v72-win32-x64.tar.gz node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.4/node-v72-win32-x64.tar.gz node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.4/node-v72-win32-x64.tar.gz node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.4 and node@12.18.3 (node-v72 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.0.4/node-v72-win32-x64.tar.gz node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.0.4 and node@12.18.3 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error Connection closed while downloading tarball file

D:\data\github\express-typescript-boilerplate\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node "" clean )

D:\data\github\express-typescript-boilerplate\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node "" clean ) gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.3 | win32 | x64 gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.3 | win32 | x64 gyp info ok gyp info ok

D:\data\github\express-typescript-boilerplate\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) else (node "" configure --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi )

D:\data\github\express-typescript-boilerplate\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) else (node "" configure --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.3 | win32 | x64 gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.3 | win32 | x64 gyp info find Python using Python version 3.8.5 found at "C:\Python38\python.exe" gyp info find Python using Python version 3.8.5 found at "C:\Python38\python.exe" gyp info find VS using VS2017 (15.9.28307.1216) found at: gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" gyp info find VS run with --verbose for detailed information gyp info find VS using VS2017 (15.9.28307.1216) found at: gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" gyp info find VS run with --verbose for detailed information gyp info spawn C:\Python38\python.exe gyp info spawn args [ gyp info spawn args 'C:\Program Files\nodejs\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 'msvs', gyp info spawn args '-I', gyp info spawn args 'D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\HP\AppData\Local\node-gyp\Cache\12.18.3\include\node\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\Users\HP\AppData\Local\node-gyp\Cache\12.18.3', gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\Users\HP\AppData\Local\node-gyp\Cache\12.18.3\<(target_arch)\node.lib', gyp info spawn args '-Dmodule_root_dir=D:\data\github\express-typescript-boilerplate\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 'D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info spawn C:\Python38\python.exe gyp info spawn args [ gyp info spawn args 'C:\Program Files\nodejs\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 'msvs', gyp info spawn args '-I', gyp info spawn args 'D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\HP\AppData\Local\node-gyp\Cache\12.18.3\include\node\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\Users\HP\AppData\Local\node-gyp\Cache\12.18.3', gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\Users\HP\AppData\Local\node-gyp\Cache\12.18.3\<(target_arch)\node.lib', gyp info spawn args '-Dmodule_root_dir=D:\data\github\express-typescript-boilerplate\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 'D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info ok

D:\data\github\express-typescript-boilerplate\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" build --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) else (node "" build --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) gyp info ok

D:\data\github\express-typescript-boilerplate\node_modules\sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" build --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) else (node "" build --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi ) gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.3 | win32 | x64 gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe gyp info spawn args [ gyp info spawn args 'build/binding.sln', gyp info spawn args '/clp:Verbosity=minimal', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.3 | win32 | x64 gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe gyp info spawn args [ gyp info spawn args 'build/binding.sln', gyp info spawn args '/clp:Verbosity=minimal', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build\deps\action_before_build.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Windows_NT 10.0.18363 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64" "--napi_version=6" "--node_abi_napi=napi" gyp ERR! cwd D:\data\github\express-typescript-boilerplate\node_modules\sqlite3 gyp ERR! node -v v12.18.3 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi' (1) node-pre-gyp ERR! stack at ChildProcess. (D:\data\github\express-typescript-boilerplate\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) node-pre-gyp ERR! System Windows_NT 10.0.18363 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\data\github\express-typescript-boilerplate\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd D:\data\github\express-typescript-boilerplate\node_modules\sqlite3 node-pre-gyp ERR! node -v v12.18.3 node-pre-gyp ERR! node-pre-gyp -v v0.10.3 node-pre-gyp ERR! not ok Failed to execute 'node-gyp.cmd build --fallback-to-build --module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=6 --node_abi_napi=napi' (1) C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\build\deps\action_before_build.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Windows_NT 10.0.18363 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\data\github\express-typescript-boilerplate\node_modules\sqlite3\lib\binding\node-v72-win32-x64" "--napi_version=6" "--node_abi_napi=napi" gyp ERR! cwd D:\data\github\express-typescript-boilerplate\node_modules\sqlite3 gyp ERR! node -v v12.18.3 gyp ERR! node-gyp -v v5.1.0

lenikhilsingh commented 4 years ago

run the command ncu -u

ncu(npm-check-updates ) basically checks for the versions of your dependencies in package.json and updates them or suggests you to update them, depending on the command you have used.

rafeyhusain-bt commented 4 years ago

Thanks @lenikhilsingh. It worked!

Now yarn start build gives error:

yarn start build

yarn start build yarn run v1.22.4 $ nps build nps is executing build : nps banner.build && nps config && nps lint && nps clean.dist && nps transpile && nps copy && nps copy.tmp && nps clean.tmp nps is executing banner.build : ts-node --transpileOnly ./commands/banner.ts build D:\data\github\express-typescript-boilerplate\node_modules\arg\index.js:90 throw err; ^

Error: Unknown or unexpected option: --transpileOnly at arg (D:\data\github\express-typescript-boilerplate\node_modules\arg\index.js:88:19) at main (D:\data\github\express-typescript-boilerplate\node_modules\ts-node\dist\bin.js:35:18) at Object. (D:\data\github\express-typescript-boilerplate\node_modules\ts-node\dist\bin.js:448:5) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { code: 'ARG_UNKNOWN_OPTION' } The script called "banner.build" which runs "ts-node --transpileOnly ./commands/banner.ts build" failed with exit code 1 https://github.com/sezna/nps/blob/master/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code The script called "build" which runs "nps banner.build && nps config && nps lint && nps clean.dist && nps transpile && nps copy && nps copy.tmp && nps clean.tmp" failed with exit code 1 https://github.com/sezna/nps/blob/master/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

ap1969 commented 4 years ago

Hi both,

I ran 'ncu -u' as well, and then got the --transpileOnly issue.

To fix this, edit the ts.config file to start as follows:

{
    "ts-node": {
        "transpileOnly": true
    },
    "compilerOptions": {
      ...

Hope that helps, Andy

ap1969 commented 4 years ago

I then hit the issue described here: https://github.com/w3tecch/express-typescript-boilerplate/issues/192

Installed the beta version of typeorm-seeding as described: npm install typeorm-seeding@1.0.0-beta.6 --save

Ran 'npm start setup.script' to skip the yarn install and just do the DB setup.

Got the error: Cannot find module 'chalk'

Ran yarn add --dev chalk

Ran 'npm start setup.script' again got the error: "Cannot find module 'figlet'"

Ran "yarn add --dev figlet"

Now got the same seeding error as before

Ran npm install typeorm-seeding@1.0.0-beta.6 --save again, but it didn't help

ap1969 commented 4 years ago

Checking my node_modules, typeorm-seeding has been updated to v1.6.1 somehow...

I removed it and re-added the beta version, and it still shows as v1.6.1

ap1969 commented 4 years ago

ALthough wierdly, the exports are correct in typeorm-seeding:

exports.setConnection = setConnection;
exports.getConnection = getConnection;
exports.define = define;
exports.factory = factory;
exports.runSeed = runSeed;
exports.times = times;
exports.loadEntityFactories = loadEntityFactories;
exports.loadSeeds = loadSeeds;
exports.loadConnection = loadConnection;
ap1969 commented 4 years ago

I give up. Can't get the example DB set up to run correctly. Still going to try to get the example app working on my own project though.

ap1969 commented 4 years ago

Following on from the above, I've got the app working fine with my own code, but didn't bother trying anything else to get the example app running. It's a good boiletplate apart from those teething problems.

L-u-n-a commented 3 years ago

I ran into this issue on Ubuntu 20.04.

I fixed it by running sudo apt-get install build-essential, and then running npm install again

I then ran into build issues as well when trying to run yarn start build. I fixed those by uninstalling my nodejs installation, ( which I had build using the nodejs binary distributions ) by running sudo apt-get purge --auto-remove nodejs, and installing it by running sudo apt install nodejs.

After this I was able to run yarn start build without errors.