prismicio-community / nuxt-starter-prismic-multi-page

Multi-page project with Nuxt & Prismic
https://nuxt-starter-prismic-multi-page.vercel.app
Apache License 2.0
6 stars 9 forks source link

prismic-cli v4 with yarn cause error #4

Open JulioJu opened 3 years ago

JulioJu commented 3 years ago

@phillysnow

With v4, during initalization, when we choose yarn as package manager, current repository is borken.

How to reproduce

  1. Instantiate project and select yarn

    $ prismic theme --theme-url https://github.com/prismicio-community/nuxt-sm-tutorial-se
    ries --conf sm.json
    ? Name your prismic repository:  https://sogilis-test-nuxt-sm-tutorial.prismic.io
    project folder [sogilis-test-nuxt-sm-tutorial]:
    Downloading starter project... Download complete
    ? package manager yarn
  2. run the app

yarn dev
  1. result On browser

We have error

Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema. - options has an unknown property 'order'. These properties are valid: object { postcssOptions?, execute?, sourceMap?, implementation? } at validate (/home/julioju/website/nuxt-sm-tutorial-series-v4/node_modules/schema-utils/dist/validate.js:105:11) at Object.loader (/home/julioju/website/nuxt-sm-tutorial-series-v4/node_modules/postcss-loader/dist/index.js:43:29) 
phillysnow commented 3 years ago

I'm not totally sure what the issue is here, but I'm investigating.

JulioJu commented 3 years ago

@phillysnow

I believe the problem is that yarn resolves dependencies in an other way than npm.

There is no yarn.lock in this folder. Therefore when we run yarn install, yarn download other dependencies than those defined into package-lock.json.

What do you think about this hypothesis ?

JulioJu commented 3 years ago

@phillysnow I've tested

rm -rf node_modules
npm install
yarn dev

=> works fine

rm -rf node_modules
yarn install
yarn dev

=> error

I believe the problem is not with yarn, but with the fact than dependencies installed by yarn are not the same than those installed by npm with its package-lock.json.

I've tried yarn import without success. But they say than yarn import is not a perfect command to migrate from package-lock.json to yarn.lock. See also https://classic.yarnpkg.com/blog/2018/06/04/yarn-import-package-lock/ .

I guess it's an important issue. I've lost a lost of time with this problem. Furthermore, yarn is the default package manager proposed by prismic-cli v4. It's problematic I guess.

Maybe prismic-cli should detect if the theme contains a yarn.lock or package-lock.json and trigger installation with the correct package manager and not give the choice. What do you think about that ?

phillysnow commented 3 years ago

I honestly have no idea what's happening here, it's clear there's a difference with the dependencies yarn is installing, but it's not related to the package-lock.json file as it persists without this.

I'm going to have to call in support from smarter people to help me on this one.

@lihbr any ideas?

JulioJu commented 3 years ago

@phillysnow thanks for your answer.

If you delete package-lock.json, there is no effect on yarn as it does not uses it when yarn install calculates dependencies to install.

phillysnow commented 3 years ago

So this is an issue with Nuxt it seems: https://github.com/nuxt/nuxt.js/issues/9205

I'm testing workarounds.