composition-api: Issue: Cannot find module '@vue/composition-api'
๐ The bug
If you launch a built application with only production dependencies without dev you will get that error above or I donโt understand what itโs mean configuration option buildModules.
๐ ๏ธ To reproduce Steps to reproduce the behavior:
- Create simple application via
yarn create nuxt-app - Add devDependencies via
yarn add -D @nuxtjs/composition-apiand add this dependency to buildModules in nuxt.config.js file - Run
yarn build - Clean
node_modulesdirectory and after that runNODE_ENV=production yarn - Run
yarn startand open browser - See error
๐ Expected behaviour Start the application without errors.
โน๏ธ Additional context
Dockerfile for reproduce problem
FROM node:latest as builder
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
FROM node:alpine
WORKDIR /app
COPY package.json yarn.lock ./
ENV NODE_ENV=production
RUN yarn
COPY nuxt.config.js ./
COPY --from=builder /app/.nuxt ./.nuxt/
COPY --from=builder /app/static ./static/
EXPOSE 3000
ENV NUXT_HOST=0.0.0.0
ENTRYPOINT [ "yarn", "run" ]
CMD [ "start" ]
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (6 by maintainers)
Commits related to this issue
- add: https://github.com/nuxt-community/composition-api/issues/290 — committed to ryamakuchi/hoge-composition-api by ryamakuchi 3 years ago
- add: https://github.com/nuxt-community/composition-api/issues/290 — committed to ryamakuchi/hoge-composition-api by ryamakuchi 3 years ago
More info: This (my) bug is from docker with the node:14.14.0-alpine3.12 image. Now I use node:10, itโs work fine ! So, do not use an alpine version of node
The transpile solution doesnโt works for me (
Cannot find module '@vue/composition-api')And when I manually install
@vue/composition-api@1.0.0-beta.17(https://github.com/nuxt-community/composition-api/issues/241#issuecomment-693927221 and version founded in requires of@nuxtjs/composition-api) I have this error:What is the good version of
@vue/composition-apito install ?For you information: I use @nuxtjs/composition-api@0.15.0 With Typescript (nuxt-ts) and Docker image node:14.14.0-alpine3.12
Thanks !
Thanks, Iโll try it today. I saw my mistake ๐
@CrazyUmka It should be the Vue composition API in the transpile array.