skeletonlabs / create-skeleton-app

CLI installer for Skeleton apps and monorepo for the sites that form the templates
16 stars 5 forks source link

npm `create skeleton-app@0.0.23` errors out, but `npm create skeleton-app@0.0.21` works fine #15

Closed riziles closed 1 year ago

riziles commented 1 year ago

Current Behavior

I stood up a little playground project a few weeks ago using npm create skeleton-app@latest and it worked great. Just tried to do a new one today, and it did not. Changed the version back to 0.0.21 and it worked fine.

Unfortunately, the error itself seems to be throwing an error:

node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFileSync (node:fs:2211:5)
    at out (file:///C:/Users/riziles/AppData/Local/npm-cache/_npx/ed0f586322dee443/node_modules/create-skeleton-app/src/creator.js:269:5)
    at createSkeleton (file:///C:/Users/riziles/AppData/Local/npm-cache/_npx/ed0f586322dee443/node_modules/create-skeleton-app/src/creator.js:108:2)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async main (file:///C:/Users/riziles/AppData/Local/npm-cache/_npx/ed0f586322dee443/node_modules/create-skeleton-app/src/index.js:26:2) {
  code: 'ERR_INVALID_ARG_TYPE'

edit: I had to downgrade Skeleton to 0.92.2 to get it working. Was getting an error wrt to theme.cjs.

Steps To Reproduce

  1. run npm create skeleton-app@0.0.21
  2. using npm@8.19.2, node@v18.12.1, Windows_NT 10.0.19044

Anything else?

I love Skeleton so hard.

Sarenor commented 1 year ago

Works fine for me @riziles, could you provide a bit more context on where the error occured? During the scaffolding with the CLI or during npm run dev?

Considering that it works when you downgrade to 0.92.2 I feel like you did not actually use the latest CLI but did grab the newest Skeleton which is going to conflict because the tailwind plugin hat a lot of breaking changes and your tailwind config now needs to look something like this:

/** @type {import('tailwindcss').Config} */
module.exports = {
    darkMode: 'class',
    content: ['./src/**/*.{html,js,svelte,ts}', require('path').join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}')],
    theme: {
        extend: {},
    },
    plugins: [
        require('@tailwindcss/forms'),
        require('@tailwindcss/typography'),
        require('@tailwindcss/line-clamp'),
        ...require('@skeletonlabs/skeleton/tailwind/skeleton.cjs')()
    ],
}

The ... spread operator and the () brackets are essential so that we can keep making changes to the plugin without breaking it for end users.

riziles commented 1 year ago

@Sarenor ,

The error occurs during scaffolding if I use @latest. The comment about downgrading to 0.92.2 was in reference to using 0.0.21. Here is the full error message I receive when using @latest. I'm a little puzzled by the Unable to download settings file for VSCode message. I am not running this inside of VS Code:

(node18) C:\LocalTemp\Repos\GitHub>npm create skeleton-app@latest skeleton9

create-skeleton-app version 0.0.23

Welcome to Skeleton ๐Ÿ’€! A UI tookit for Svelte + Tailwind

This is BETA software; expect bugs and missing features.

Problems? Open an issue on https://github.com/skeletonlabs/skeleton/issues if none exists already.

โˆš Add type checking with TypeScript? ยป Yes, using TypeScript syntax
โˆš Add ESLint for code linting? ... No / Yes
โˆš Add Prettier for code formatting? ... No / Yes
โˆš Add Playwright for browser testing? ... No / Yes
โˆš Add Vitest for unit testing? ... No / Yes
โˆš Enable Svelte-Kit experimental inspector http://bit.ly/3Hu0BGf ? ... No / Yes
โˆš Pick tailwind plugins to add: ยป
โˆš Select a theme: ยป Skeleton
โˆš Which Skeleton app template? ยป Skeleton Welcome
Working: Creating base SvelteKit install.        
Working: Installing project dependencies.
Unable to download settings file for VSCode, please read manual instructions at https://skeleton.dev
node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFileSync (node:fs:2211:5)
    at out (file:///C:/Users/riziles/AppData/Local/npm-cache/_npx/ed0f586322dee443/node_modules/create-skeleton-app/src/creator.js:269:5)
    at createSkeleton (file:///C:/Users/riziles/AppData/Local/npm-cache/_npx/ed0f586322dee443/node_modules/create-skeleton-app/src/creator.js:108:2)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async main (file:///C:/Users/riziles/AppData/Local/npm-cache/_npx/ed0f586322dee443/node_modules/create-skeleton-app/src/index.js:26:2) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v18.12.1
npm ERR! code 1
npm ERR! path C:\LocalTemp\Repos\GitHub
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c create-skeleton-app skeleton9

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\riziles\AppData\Local\npm-cache\_logs\2023-01-27T14_51_10_444Z-debug-0.log
cyborgdennett commented 1 year ago

I have the same error. Creating my-skeleton-app with a theme.

The dependencies in package.json are not filled for some reason

cyborgdennett commented 1 year ago
"devDependencies": {
        "@playwright/test": "^1.28.1",
        "@sveltejs/adapter-auto": "^1.0.0",
        "@sveltejs/kit": "^1.0.0",
        "@typescript-eslint/eslint-plugin": "^5.45.0",
        "@typescript-eslint/parser": "^5.45.0",
        "eslint": "^8.28.0",
        "eslint-config-prettier": "^8.5.0",
        "eslint-plugin-svelte3": "^4.0.0",
        "prettier": "^2.8.0",
        "prettier-plugin-svelte": "^2.8.1",
        "svelte": "^3.54.0",
        "svelte-check": "^3.0.1",
        "tslib": "^2.4.1",
        "typescript": "^4.9.3",
        "vite": "^4.0.0",
        "vitest": "^0.25.3"
    },

These are what I get, where is skeleton dependency?

cyborgdennett commented 1 year ago

^ Above was the output with the example app template

Creating a Bare Bones project does give me the dependency's.

endigo9740 commented 1 year ago

@riziles @cyborgdennett @Sarenor Wrong project, I've moved this over to this CLI repo.

@niktek Currently maintains the CLI but it's late his time right now, so we'll need to wait for him to come online and review the issue. It sounds like something has updated upstream and we'll need to put out an update to the CLI to resolve this. I'd ask for your patience in the meantime.

Thanks for alerting us to this!

riziles commented 1 year ago

@riziles @cyborgdennett @Sarenor Wrong project, I've moved this over to this CLI repo.

Whoops! Sorry about that. Thanks for the prompt response!

niktek commented 1 year ago

I've added some more error checking around the writing of the .vscode/settings.json file that was the root cause of the issue.

Just an FYI - older versions of the CLI will still download the latest Skeleton package as there is no direct reference to any version numbers of any packages in the CLI - however it WILL do the setup according to the CLI version number as it has that hardcoded in it. So basically trying to use any version other than @latest is just going to apply an incorrect setup to the latest version of Skeleton.

@cyborgdennett at this point I'm going to assume there was some flow on effect from the error on the download of settings.json. I've done an install of barebones and welcome to skeleton and the Skeleton dependency is in both package.json's. Please open another issue if you still see a problem.

riziles commented 1 year ago

@niktek and team,

Just ran npm create skeleton-app@latest and it worked like a charm! You guys rock. FWIW, the only reason I opened the issue is because I love Skeleton, and I wanted to make sure any other potential users out there didn't get turned away by an error message.

niktek commented 1 year ago

Oh we definitely like these issues being raised - I hate finding out that it isn't working for people and that it's been causing them problems for a while!