Wyszukiwanie w witrynie

typescript - błąd instalacji npm Svelte, Skeleton, Tailwind


Jestem dość nowy w świecie svelte/typescript i od wczoraj nagle pojawiają się błędy po instalacji. Robiłem dokładnie te same rzeczy kilka dni temu i nie mogę zrozumieć, co się dzieje.

Oto, co zrobiłem:

npm create svelte@latest diceGame

cd diceGame

npm install

Potem zainstalowałem Skeleton

npm i @skeletonlabs/skeleton --save-dev

Potem zainstalowałem Tailwind

npx svelte-add@latest tailwindcss

npm install

Teraz otrzymuję błąd, jak widać na zrzucie ekranu

Czy ktoś ma jakieś sugestie/pomysły, co mógłbym zrobić, aby mieć czystą instalację?

Odpowiedź #1

Postępuj zgodnie z dokumentacją rozpoczęcia korzystania z interfejsu szkieletowego.

Ostatnio kilkakrotnie postępowałem według tych kroków i nigdy nie miałem problemu.

npm create svelte@latest diceGame
cd diceGame
npm i
npm i -D @skeletonlabs/skeleton @skeletonlabs/tw-plugin
npx svelte-add@latest tailwindcss
npm i
npm add -D @types/node

Następnie skonfiguruj swój Tailwind używając rozszerzenia pliku .ts.

import { join } from 'path';
import type { Config } from 'tailwindcss';

// 1. Import the Skeleton plugin
import { skeleton } from '@skeletonlabs/tw-plugin';

const config = {
    // 2. Opt for dark mode to be handled via the class method
    darkMode: 'class',
    content: [
        './src/**/*.{html,js,svelte,ts}',
        // 3. Append the path to the Skeleton package
        join(require.resolve(
            '@skeletonlabs/skeleton'),
            '../**/*.{html,js,svelte,ts}'
        )
    ],
    theme: {
        extend: {},
    },
    plugins: [
        // 4. Append the Skeleton plugin (after other plugins)
        skeleton
    ]
} satisfies Config;

export default config;