无法安装 Sveltejs

Could not install Sveltejs

以下命令用于安装 Svelte:

git clone https://github.com/sveltejs/svelte.git
cd svelte
npm install

创建compiler.js后报如下错误。 运行 在 MacOS Big Sur 和节点 v14.15.0 上

created compiler.js, compiler.mjs in 1.5s

> svelte@3.29.7 tsd /Users/kale/svelte
> tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly

../node_modules/@types/request/index.d.ts:66:15 - error TS2430: Interface 
'DefaultUriUrlRequestApi<TRequest, TOptions, TUriUrlOptions>' incorrectly extends interface 
'RequestAPI<TRequest, TOptions, TUriUrlOptions>'.
  Types of property 'defaults' are incompatible.
  Type '(options: TOptions) => DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>' 
  is not assignable to type '{ (options: TOptions): RequestAPI<TRequest, TOptions, 
  RequiredUriUrl>; (options: (UriOptions & TOptions) | (UrlOptions & TOptions)): 
DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>; }'.
  Type 'DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>' is not assignable to 
type 'RequestAPI<TRequest, TOptions, RequiredUriUrl>'.
    Types of property 'delete' are incompatible.
      Type '{ (uri: string, options?: TOptions, callback?: RequestCallback): TRequest; (uri: 
string, callback?: RequestCallback): TRequest; (options: OptionalUriUrl & TOptions, 
callback?: RequestCallback): TRequest; }' is not assignable to type '{ (uri: string, 
options?: TOptions, callback?: RequestCallback): TRequest; (uri: string, callback?: 
RequestCallback): TRequest; (options: (UriOptions & TOptions) | (UrlOptions & TOptions), 
callback?: RequestCallback): TRequest; }'.
        Types of parameters 'options' and 'options' are incompatible.
          Type '(UriOptions & TOptions) | (UrlOptions & TOptions)' is not assignable to type 
'OptionalUriUrl & TOptions'.
            Type 'UriOptions & TOptions' is not assignable to type 'OptionalUriUrl & 
TOptions'.
              Type 'UriOptions & TOptions' is not assignable to type 'OptionalUriUrl'.
                Types of property 'uri' are incompatible.
                  Type 'string | Url' is not assignable to type 'string'.
                    Type 'Url' is not assignable to type 'string'.

66     interface DefaultUriUrlRequestApi<TRequest extends Request,
             ~~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte@3.29.7 tsd: `tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime 
--emitDeclarationOnly`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the svelte@3.29.7 tsd script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output 
above.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte@3.29.7 build: `rollup -c && npm run tsd`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the svelte@3.29.7 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output 
above.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte@3.29.7 prepare: `npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the svelte@3.29.7 prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output         
above.

为了安装 svelte,您需要git 克隆它的模板而不是源代码。

这里是 template

要么使用svelte officail website

中写的步骤
npx degit sveltejs/template my-svelte-project

cd my-svelte-project
npm install
npm run dev

或者你可以

git clone https://github.com/sveltejs/template.git new-proj

cd new-proj
npm install
npm run dev