TehNut / AniSchedule

A Discord bot that notifies you when a new anime episode has aired
MIT License
39 stars 15 forks source link

Queries are not copied to dist on build #5

Closed huntrshado closed 4 years ago

huntrshado commented 4 years ago

Following the instructions to set up: npm install runs fine. Created a .env file (for example, ani.env) in the directory C:\AniSchedule with the specified content. Running npm start creates the following error:

C:\AniSchedule>npm start

anischedule@1.1.4 start C:\AniSchedule tsc && node dist/AniSchedule.js

internal/fs/utils.js:298 throw err; ^

Error: ENOENT: no such file or directory, open 'C:\AniSchedule\dist\query\Watching.graphql' at Object.openSync (fs.js:465:3) at Object.readFileSync (fs.js:368:35) at Object. (C:\AniSchedule\dist\command\CommandWatching.js:16:28) at Module._compile (internal/modules/cjs/loader.js:1201:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10) at Module.load (internal/modules/cjs/loader.js:1050:32) at Function.Module._load (internal/modules/cjs/loader.js:938:14) at Module.require (internal/modules/cjs/loader.js:1090:19) at require (internal/modules/cjs/helpers.js:75:18) at Object. (C:\AniSchedule\dist\command\Command.js:15:1) { errno: -4058, syscall: 'open', code: 'ENOENT', path: 'C:\AniSchedule\dist\query\Watching.graphql' } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! anischedule@1.1.4 start: tsc && node dist/AniSchedule.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the anischedule@1.1.4 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Plex\AppData\Roaming\npm-cache_logs\2020-07-23T01_30_52_288Z-debug.log

Troubleshooting so far: I've tried the last 5 node.js versions, also tried installed AniSchedule 1.13, 1.14, 1.15, 2.0.0. Log: 2020-07-23T01_30_52_288Z-debug.log

TehNut commented 4 years ago

Oops, looks like I forgot to fix the issue where the graphql files aren't copied over. I'll update the start script to copy those over properly soon.

For now, you should be able to copy the .graphql files from src/query into dist/query.

huntrshado commented 4 years ago

Thanks for the prompt reply. Following your suggestion, copying the files from src/query into dist/query and then running 'npm start' resulted in a new error.

C:\AniSchedule>npm start

anischedule@1.1.4 start C:\AniSchedule tsc && node dist/AniSchedule.js

internal/fs/utils.js:701 throw new ERR_INVALID_ARG_TYPE( ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object at Object.writeFileSync (fs.js:1409:5) at getOrCreateStorage (C:\AniSchedule\dist\AniSchedule.js:35:14) at Object. (C:\AniSchedule\dist\AniSchedule.js:24:17) at Module._compile (internal/modules/cjs/loader.js:1201:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10) at Module.load (internal/modules/cjs/loader.js:1050:32) at Function.Module._load (internal/modules/cjs/loader.js:938:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { code: 'ERR_INVALID_ARG_TYPE' } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! anischedule@1.1.4 start: tsc && node dist/AniSchedule.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the anischedule@1.1.4 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Plex\AppData\Roaming\npm-cache_logs\2020-07-23T02_37_03_569Z-debug.log

TehNut commented 4 years ago

I'm dumb, I forgot to serialize the default storage data. This one you should be able to bypass by creating data.json in the root directory with {"servers":[]} as it's contents.

TehNut commented 4 years ago

Alright, I've pushed some new commits that move the compilation into npm build which will properly copy the necessary files over. The README has been updated to address this. A fix was also pushed for your second issue.