【问题标题】:How to use an older version of sveltekit?如何使用旧版本的 sveltekit?
【发布时间】:2021-09-09 09:23:47
【问题描述】:

如何使用 npm 启动旧版 SvelteKit? 我试过了

npm init svelte@next.104 
npm init sveltejs/kit@1.0.0-next.104
npm init @sveltejs/kit/@1.0.0-next.104

和类似的组合没有成功。我得到(例如):

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@sveltejs%2fcreate-kit - Not found
npm ERR! 404
npm ERR! 404  '@sveltejs/create-kit@1.0.0-next.104' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\marti\AppData\Roaming\npm-cache\_logs\2021-09-09T13_53_44_704Z-debug.log
Install for [ '@sveltejs/create-kit@1.0.0-next.104' ] failed with code 1

我想使用旧版本 (104),因为 https://codesandbox.io/s/3dxrg 使用 Swiper 7.0.3 和 SvelteKit v1.0.0-next.104

也可以在Sveltekit: Cannot find module 'swiper'查看我的问题

【问题讨论】:

    标签: npm-install sveltekit


    【解决方案1】:

    npm init svelte@next 运行包create-svelte (NPM docs) 的bin,该包独立于主套件包进行版本控制和发布。此外,生成的模板没有固定到特定的套件版本。

    如果您需要使用旧版本的 SvelteKit,则需要在引导项目后手动降级版本。您可以使用最新的create-svelte 版本在套件v1.0.0-next.104 发布时,在查看更改日志git 历史记录(create-svelte/kit)后我相信是create-svelte@2.0.0-next.71

    运行:

    npm init svelte@2.0.0-next.71
    

    然后将package.json改为使用

    "devDependencies": {
        "@sveltejs/kit": "1.0.0-next.104",
    ...
    

    然后像往常一样npm install

    请记住,由于 SvelteKit 是测试版,并且更改发生得很快,因此在使用旧版本时可能会遇到其他依赖问题。

    【讨论】:

    • 感谢您的详细解释。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-04
    • 1970-01-01
    • 1970-01-01
    • 2011-04-11
    相关资源
    最近更新 更多