prismic-cli v4 with yarn cause error
Opened this issue · 6 comments
With v4, during initalization, when we choose yarn
as package manager, current repository is borken.
How to reproduce
- 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
- run the app
yarn dev
- 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)
I'm not totally sure what the issue is here, but I'm investigating.
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 ?
@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 ?
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?
@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.
So this is an issue with Nuxt it seems:
nuxt/nuxt#9205
I'm testing workarounds.