YunYouJun/cook

`@unocss/reset` dependency

henryclw opened this issue · 6 comments

From #9 (comment)

If I don't add "@unocss/reset": "^0.6.3", in package.json, it will show an error like this:
image

Here is where the project imports @unocss/reset

import '@unocss/reset/tailwind.css'

Possible solutions:

  • Remove import of @unocss/reset
  • Add the package in package.json

Did you use pnpm i to install it?

I kept pnpm-lock.yaml in this project to ensure its dependencies are exactly correct.

npm i -g pnpm

pnpm i

I think it will work.

I kept pnpm-lock.yaml in this project to ensure its dependencies are exactly correct.

npm i -g pnpm

pnpm i

I think it will work.

Yes I did install the packages like this, using a dockerfile:

FROM node:lts-alpine

RUN apk update

RUN apk add xdg-utils

RUN npm install -g pnpm

WORKDIR /app

COPY package*.json ./

RUN pnpm install

COPY . .

# convert csv to json
# automatically executed when postinstall
RUN pnpm convert

EXPOSE 3333

ENTRYPOINT ["pnpm", "dev"]

The building step 7 has the following logs:

Step 7/11 : RUN pnpm install
 ---> Running in 99eec05a6605
Progress: resolved 1, reused 0, downloaded 0, added 0
Progress: resolved 48, reused 0, downloaded 34, added 0
Progress: resolved 124, reused 0, downloaded 104, added 0
Progress: resolved 198, reused 0, downloaded 175, added 0
Progress: resolved 327, reused 0, downloaded 276, added 0
Progress: resolved 399, reused 0, downloaded 346, added 0
Progress: resolved 553, reused 0, downloaded 492, added 0
Progress: resolved 736, reused 0, downloaded 661, added 0
Packages: +808
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 828, reused 0, downloaded 758, added 0
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /root/.pnpm-store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 828, reused 0, downloaded 808, added 808, done
.../node_modules/vue-demi postinstall$ node ./scripts/postinstall.js
.../node_modules/vue-demi postinstall: Done
.../esbuild@0.14.36/node_modules/esbuild postinstall$ node install.js
.../esbuild@0.14.36/node_modules/esbuild postinstall: Done
?WARN? "postinstall" script of "@" inside "/app" is skipped as the working directory seems suspicious. To run this lifecycle script anyway, use "--unsafe-perm".

dependencies:
+ @gtm-support/vue-gtm 1.4.0
+ @vueuse/core 8.2.6
+ @vueuse/head 0.7.6
+ nprogress 0.2.0
+ pinia 2.0.13
+ prism-theme-vars 0.2.2
+ vue 3.2.33
+ vue-demi 0.12.5
+ vue-router 4.0.14

devDependencies:
+ @antfu/eslint-config 0.20.6
+ @iconify-json/fe 1.1.1
+ @iconify-json/gg 1.1.1
+ @iconify-json/ic 1.1.2
+ @iconify-json/mdi 1.1.9
+ @iconify-json/ri 1.1.1
+ @types/markdown-it-link-attributes 3.0.1
+ @types/nprogress 0.2.0
+ @vitejs/plugin-vue 2.3.1
+ consola 2.15.3
+ critters 0.0.16
+ cross-env 7.0.3
+ eslint 8.13.0
+ esno 0.14.1
+ https-localhost 4.7.1
+ markdown-it-link-attributes 4.0.0
+ markdown-it-prism 2.2.4
+ pnpm 6.32.9
+ sass 1.50.1
+ star-markdown-css 0.3.3
+ typescript 4.6.3
+ unocss 0.31.6
+ unplugin-auto-import 0.7.1
+ unplugin-vue-components 0.19.3
+ vite 2.9.5
+ vite-plugin-inspect 0.5.0
+ vite-plugin-md 0.12.4
+ vite-plugin-pages 0.23.0
+ vite-plugin-pwa 0.11.13 (0.12.0 is available)
+ vite-plugin-vue-layouts 0.6.0
+ vite-ssg 0.19.2
+ vite-ssg-sitemap 0.2.4
+ vue-tsc 0.34.7

Removing intermediate container 99eec05a6605

So it seems to have unocss 0.31.6 installed? But still it'll say [plugin:vite:import-analysis] Failed to resolve import "@unocss/reset/tailwind.css" from "src/main.ts". Does the file exist?

I know this can be solved by add one line in package.json
image

I can provide further details, here's the output of pnpm list

/app # pnpm list
Legend: production dependency, optional only, dev only

/app (PRIVATE)

dependencies:
@gtm-support/vue-gtm 1.4.0
@vueuse/core 8.2.6
@vueuse/head 0.7.6
nprogress 0.2.0
pinia 2.0.13
prism-theme-vars 0.2.2
vue 3.2.33
vue-demi 0.12.5
vue-router 4.0.14

devDependencies:
@antfu/eslint-config 0.20.6               pnpm 6.32.9
@iconify-json/fe 1.1.1                    sass 1.50.1
@iconify-json/gg 1.1.1                    star-markdown-css 0.3.3
@iconify-json/ic 1.1.2                    typescript 4.6.3
@iconify-json/mdi 1.1.9                   unocss 0.31.6
@iconify-json/ri 1.1.1                    unplugin-auto-import 0.7.1
@types/markdown-it-link-attributes 3.0.1  unplugin-vue-components 0.19.3
@types/nprogress 0.2.0                    vite 2.9.5
@vitejs/plugin-vue 2.3.1                  vite-plugin-inspect 0.5.0
consola 2.15.3                            vite-plugin-md 0.12.4
critters 0.0.16                           vite-plugin-pages 0.23.0
cross-env 7.0.3                           vite-plugin-pwa 0.11.13
eslint 8.13.0                             vite-plugin-vue-layouts 0.6.0
esno 0.14.1                               vite-ssg 0.19.2
https-localhost 4.7.1                     vite-ssg-sitemap 0.2.4
markdown-it-link-attributes 4.0.0         vue-tsc 0.34.7
markdown-it-prism 2.2.4

We have unocss but not @unocss/reset

See

cook/pnpm-lock.yaml

Lines 6070 to 6083 in 8a36f79

/unocss/0.31.6_vite@2.9.5:
resolution: {integrity: sha512-l11KyUWtOEuXibulA4Xf4pcnGByzv7jLSN6oSVF9gW6bcQFt6oO+23jg36G9eckV17FzRmMbdJMRXSq6RyrRjg==}
engines: {node: '>=14'}
dependencies:
'@unocss/cli': 0.31.6
'@unocss/core': 0.31.6
'@unocss/preset-attributify': 0.31.6
'@unocss/preset-icons': 0.31.6
'@unocss/preset-mini': 0.31.6
'@unocss/preset-typography': 0.31.6
'@unocss/preset-uno': 0.31.6
'@unocss/preset-web-fonts': 0.31.6
'@unocss/preset-wind': 0.31.6
'@unocss/reset': 0.31.6

@unocss/reset is included in unocss. Do you loss pnpm-lock.yaml?

See

cook/pnpm-lock.yaml

Lines 6070 to 6083 in 8a36f79

/unocss/0.31.6_vite@2.9.5:
resolution: {integrity: sha512-l11KyUWtOEuXibulA4Xf4pcnGByzv7jLSN6oSVF9gW6bcQFt6oO+23jg36G9eckV17FzRmMbdJMRXSq6RyrRjg==}
engines: {node: '>=14'}
dependencies:
'@unocss/cli': 0.31.6
'@unocss/core': 0.31.6
'@unocss/preset-attributify': 0.31.6
'@unocss/preset-icons': 0.31.6
'@unocss/preset-mini': 0.31.6
'@unocss/preset-typography': 0.31.6
'@unocss/preset-uno': 0.31.6
'@unocss/preset-web-fonts': 0.31.6
'@unocss/preset-wind': 0.31.6
'@unocss/reset': 0.31.6

@unocss/reset is included in unocss. Do you loss pnpm-lock.yaml?

My bad. I only copied the package.json file and didn't copy the pnpm-lock.yaml file. That's why this is happenning.

Thank you for your kind reply.