Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building website failing #54

Open
hello-stark opened this issue Dec 23, 2022 · 15 comments
Open

Building website failing #54

hello-stark opened this issue Dec 23, 2022 · 15 comments

Comments

@hello-stark
Copy link

hello-stark commented Dec 23, 2022

This is hard for me to debug since I am not a js dev, and there is no mention or location of error here.

Steps to reproduce

  • set token etc, set config
  • use the selector to select build

System info

  • Windows 11 Powershell / Ubuntu 22.04 bash, happens in both

Output logs

    █▀█ █▀█ █▀█ ▀█▀ █▀▀ █▀█ █░░ █ █▀█
    █▀▀ █▄█ █▀▄ ░█░ █▀░ █▄█ █▄▄ █ █▄█
https://github.com/shaansubbaiah/Portfolio

? What would you like to do? Build Portfolio
Fetching data from GitHub
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.12.1
@shaansubbaiah
Copy link
Owner

Yeah the error isn't apparent from the log :/

It fails while fetching the data so it might be that the token hasn't been created with the sufficient permissions.

I'll take a deeper look when I get to my computer. Thanks for reporting.

@hello-stark
Copy link
Author

No problem, also turns out, copying the latest files made it work.
There were undefined variables etc in getData.js (of v2.0) which are fixed in the latest commits.

If you cant duplicate and isolate the above issues, please create a new release it should work fine for most users atleast

@hello-stark
Copy link
Author

Also figured out that with infolinks, this is how the website was being generated
Untitled

@shaansubbaiah
Copy link
Owner

No problem, also turns out, copying the latest files made it work. There were undefined variables etc in getData.js (of v2.0) which are fixed in the latest commits.

If you cant duplicate and isolate the above issues, please create a new release it should work fine for most users atleast

Yeah I was gonna release v2.1 with the fixes, forgot to go about it. I'll do that in a bit.

I'll take a look into the infolinks issue 👍

@shaansubbaiah
Copy link
Owner

shaansubbaiah commented Dec 23, 2022

@hello-stark can you try with the latest commit (37b0ee0) ? I was able to build the page with no issues. Config and output for reference:

{
	"username": "shaansubbaiah",
	"repos": 15,
	"avatar": "",
	"linkedinURL": "https://www.linkedin.com/in/shaansubbaiah/",
	"twitterId": "",
	"gitlabId": "",
	"socialPreviewImage": true,
	"profileREADME": false,
	"navLinks": [
		{
			"name": "link1",
			"link": "https://www.link1.com"
		},
		{
			"name": "link2",
			"link": "https://www.link2.com"
		}
	],
	"infoLinks": [
		{
			"name": "ilink1",
			"link": "https://www.ilink1.com"
		},
		{
			"name": "ilink2",
			"link": "https://www.ilink2.com"
		}
	]
}

image

If it fixes it for you, I'll add it to the latest release fix.

@hello-stark
Copy link
Author

Ok @shaansubbaiah , the get data part is working now, but the build is still failing for some reason

    █▀█ █▀█ █▀█ ▀█▀ █▀▀ █▀█ █░░ █ █▀█
    █▀▀ █▄█ █▀▄ ░█░ █▀░ █▄█ █▄▄ █ █▄█
https://github.com/shaansubbaiah/Portfolio

? What would you like to do? Build Portfolio
Fetching data from GitHub
---- Writing data to C:\Users\root\Documents\projects\Portfolio-2.0\github-data.json
Downloading images from GitHub
---- Downloaded avatar
---- Downloaded repo social preview images
Running 'npm run build'
node:internal/errors:863
  const err = new Error(message);
              ^

Error: Command failed: npm run build
[vite]: Rollup failed to resolve import "@fontsource/poppins/400.css" from "src/main.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "@fontsource/poppins/400.css" from "src/main.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at onRollupWarning (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:45526:19)
    at onwarn (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:45297:13)
    at Object.onwarn (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/rollup/dist/es/shared/rollup.js:23263:13)
    at ModuleLoader.handleResolveId (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/rollup/dist/es/shared/rollup.js:22158:26)
    at file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/rollup/dist/es/shared/rollup.js:22119:26

    at ChildProcess.exithandler (node:child_process:412:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'npm run build',
  stdout: '\n' +
    '> [email protected] build\n' +
    '> vite build\n' +
    '\n' +
    '\x1B[36mvite v3.2.4 \x1B[32mbuilding for production...\x1B[36m\x1B[39m\n' +
    'transforming...\n' +
    '\x1B[32m✓\x1B[39m 3 modules transformed.\n',
  stderr: '\x1B[31m[vite]: Rollup failed to resolve import "@fontsource/poppins/400.css" from "src/main.js".\n' +
    'This is most likely unintended because it can break your application at runtime.\n' +
    'If you do want to externalize this module explicitly add it to\n' +
    '`build.rollupOptions.external`\x1B[39m\n' +
    '\x1B[31merror during build:\n' +
    'Error: [vite]: Rollup failed to resolve import "@fontsource/poppins/400.css" from "src/main.js".\n' +
    'This is most likely unintended because it can break your application at runtime.\n' +
    'If you do want to externalize this module explicitly add it to\n' +
    '`build.rollupOptions.external`\n' +
    '    at onRollupWarning (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:45526:19)\n' +
    '    at onwarn (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:45297:13)\n' +
    '    at Object.onwarn (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/rollup/dist/es/shared/rollup.js:23263:13)\n' +
    '    at ModuleLoader.handleResolveId (file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/rollup/dist/es/shared/rollup.js:22158:26)\n' +
    '    at file:///C:/Users/root/Documents/projects/Portfolio-2.0/node_modules/rollup/dist/es/shared/rollup.js:22119:26\x1B[39m\n'
}

Node.js v18.12.1

this appears to be some sort of setup issue for me
Reference - https://stackoverflow.com/a/69170378

@shaansubbaiah
Copy link
Owner

Can you share your package.json? Might be caused due to one of the packages being newer than what I used.

@hello-stark
Copy link
Author

Here you go, sorry for the late reply

{
  "name": "portfolio",
  "private": true,
  "version": "1.6.0",
  "description": "Automatically generates a responsive, static-site with the user’s Github projects.",
  "type": "module",
"scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "author": "Shaan Subbaiah <[email protected]>",
  "license": "MIT",
  "dependencies": {},
  "devDependencies": {
    "vite": "^3.2.3",
    "vite-plugin-handlebars": "^1.6.0",
    "axios": "^0.21.2",
    "dotenv": "^8.2.0",
    "fs-extra": "^9.0.1",
    "inquirer": "^9.1.4",
    "markdown-it": "^12.3.2",
    "sharp": "^0.30.2"
  }
}

@hello-stark
Copy link
Author

Upon deleting the entire node_modules folder and reinstalling with latest package.json as per the repo, I kept getting the following error

---- Downloaded repo social preview images
Running 'npm run build'
(node:483) UnhandledPromiseRejectionWarning: Error: Command failed: npm run build
file:///mnt/c/Users/arook/Documents/projects/Portfolio-2.0/node_modules/vite/bin/vite.js:7
    await import('source-map-support').then((r) => r.default.install())
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
(node:483) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:483) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@shaansubbaiah
Copy link
Owner

This looks like an issue with your Node or Vite installation. I've published the latest commits to the v2.1 release for now. I suggest setting up the project fresh, cloning the latest release/commit and installing the npm packages again and testing.

I use Manjaro and I'm pretty sure I'm also on Node v18 too, I'll cross check and get back to you.

@shaansubbaiah
Copy link
Owner

I was running node v17.2, upgraded to latest LTS - v18.12.1 and was unable to reproduce the issue. I think it might be an installation problem on your end, not entirely sure tho.

❯ node --version
v18.12.1
❯ npm --version
9.2.0
❯ cat package.json
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: package.json
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ {
   2   │   "name": "portfolio",
   3   │   "private": true,
   4   │   "version": "2.1",
   5   │   "description": "Automatically generates a responsive, static-site with the user’s Github projects.",
   6   │   "type": "module",
   7   │   "scripts": {
   8   │     "dev": "vite",
   9   │     "build": "vite build",
  10   │     "preview": "vite preview"
  11   │   },
  12   │   "author": "Shaan Subbaiah <[email protected]>",
  13   │   "license": "MIT",
  14   │   "dependencies": {
  15   │     "@fontsource/poppins": "^4.5.10",
  16   │     "canvas-confetti": "^1.6.0",
  17   │     "masonry-layout": "^4.2.2"
  18   │   },
  19   │   "devDependencies": {
  20   │     "axios": "^0.21.2",
  21   │     "dotenv": "^8.2.0",
  22   │     "fs-extra": "^9.0.1",
  23   │     "inquirer": "^9.1.4",
  24   │     "markdown-it": "^12.3.2",
  25   │     "sharp": "^0.30.2",
  26   │     "vite": "^3.2.3",
  27   │     "vite-plugin-handlebars": "^1.6.0"
  28   │   }
  29   │ }
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ npm run build
> [email protected] build
> vite build

vite v3.2.4 building for production...
✓ 24 modules transformed.
../dist/assets/poppins-devanagari-400-normal.478b3ab7.woff2   38.64 KiB
../dist/assets/poppins-latin-ext-400-normal.cb8bdeab.woff2    5.41 KiB
../dist/assets/poppins-devanagari-500-normal.721c714f.woff2   38.22 KiB
../dist/assets/poppins-latin-400-normal.7d93459d.woff2        7.70 KiB
../dist/assets/poppins-latin-ext-500-normal.5f9d6298.woff2    5.32 KiB
../dist/assets/poppins-latin-500-normal.cd36de20.woff2        7.57 KiB
../dist/assets/poppins-latin-ext-600-normal.9c15f7b0.woff2    5.38 KiB
../dist/assets/poppins-devanagari-600-normal.d036ece3.woff2   38.40 KiB
../dist/assets/poppins-latin-600-normal.f4e80d9d.woff2        7.81 KiB
../dist/assets/poppins-devanagari-700-normal.6197a412.woff2   38.23 KiB
../dist/assets/poppins-latin-ext-700-normal.4ce2c84c.woff2    5.26 KiB
../dist/assets/poppins-latin-700-normal.9338e65f.woff2        7.63 KiB
../dist/assets/poppins-all-400-normal.c68e1edb.woff           65.01 KiB
../dist/assets/poppins-all-500-normal.9ec8c55c.woff           64.22 KiB
../dist/assets/poppins-all-600-normal.952d2591.woff           64.68 KiB
../dist/assets/poppins-all-700-normal.282b1ac4.woff           64.08 KiB
../dist/index.html                                            18.90 KiB
../dist/assets/index.b62803af.js                              31.38 KiB / gzip: 10.71 KiB
../dist/assets/index.8e0b01b9.css                             11.09 KiB / gzip: 2.42 KiB

@hello-stark
Copy link
Author

My setup info, i have deleted the entire folder, cloned it afresh, setup the config.json newly as well

❯ node --version
v18.12.1

❯ npm --version
8.19.2

❯ cat package.json
{
  "name": "portfolio",
  "private": true,
  "version": "1.6.0",
  "description": "Automatically generates a responsive, static-site with the user’s Github projects.",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "author": "Shaan Subbaiah <[email protected]>",
  "license": "MIT",
  "dependencies": {
    "@fontsource/poppins": "^4.5.10",
    "canvas-confetti": "^1.6.0",
    "masonry-layout": "^4.2.2"
  },
  "devDependencies": {
    "axios": "^0.21.2",
    "dotenv": "^8.2.0",
    "fs-extra": "^9.0.1",
    "inquirer": "^9.1.4",
    "markdown-it": "^12.3.2",
    "sharp": "^0.30.2",
    "vite": "^3.2.3",
    "vite-plugin-handlebars": "^1.6.0"
  }
}

Build succeeded now, in the latest download of the repo.

But the website is still broken because of the following incase of trying to just open the html file in browser.
image

And in case of live deployment at localhost, the following is coming in the console
image

Is this some sort of issue with my browsers privacy settings etc?
I tested with all shields + adblockers turned off, still same issue

@hello-stark
Copy link
Author

hello-stark commented Dec 28, 2022

I fixed the issue by changing the
image

TO
image

Looks like /assets etc is trying to fetch from root directory and not current directory
Similar changes were done to /svg & /images

@shaansubbaiah
Copy link
Owner

The way I've imported the CSS in src/main.js seems fine, not sure why it doesn't show in the live preview. @hello-stark when you deploy the website without making these changes, does the website load correctly? I'll have to test to see if its due to how Windows/WSL handles paths

I fixed the issue by changing the image

TO image

Looks like /assets etc is trying to fetch from root directory and not current directory Similar changes were done to /svg & /images

@hello-stark
Copy link
Author

Nope, i tried github deploy as well, it doesnt work without the changes i made.
I also initially thought this was a windows issue and considered ignoring it as my local setup issue, but perhaps not

@shaansubbaiah as per docs what you have done is techincally right, but it isnt working as expected for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants