4

我在运行 npm start used snowpack.dev https://www.snowpack.dev/时收到此错误

[snowpack] ! updating dependencies...
[snowpack] ! installing dependencies…
[snowpack] Package "abstracts/variables" not found. Have you installed it?
[snowpack] Install failed.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `snowpack dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2020-09-15T12_18_05_035Z-debug.log
PS G:\antonio\projects\react\app>
4

1 回答 1

0

你在用baseUrltsconfig.json

如果你通过配置导入./src/abstracts,你需要在你的 snowpack 配置文件中设置一个别名( Docs here )。abstracts/[whateverfile]baseUrl

  1. snowpack.config.js如果您还没有这样做,请创建。将它放在应用程序的根目录中,与package.json.

  2. snowpack.config.js中,添加:


module.exports = {

    ...

    alias: {
        abstracts: '/src/abstracts',
        // continue for remaining directories in /src
    },

    ...

}


于 2021-02-01T23:03:49.810 回答