https://codesandbox.io/s/github/zabavnikov/nuxt-store
Run codesandbox
Nuxt will find store files
path should be a path.relative()d string, but got "../../store/users.js"
Prior to version 2.13.0, such a path to the store worked.
I have a basic Nuxt configuration and there are two Nuxt configurations (which inherit from the basic), one for the mobile version, the other for the desktop.
The applications/mobile/nuxt.config.js file will merge with the main config, but an error appears immediately after the server starts - path should be a path.relative()d string, but got "../../store/users.js"
I'm having the same issue. I have two configurations and my application started presented this issue.
Hello! Has anyone managed to overcome this problem?
Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:
Issues that are labeled as pending will not be automatically marked as stale.
After some digging I found out changing packages/builder/package.json to "ignore": "4.0.6" it works with dev branch.
On tag v2.12.2 with ignore module on 5.1.4 it works too, but on dev branch with 5.1.4 it doesn't... not sure if anything else can cause this?
Git blame did not reveal anything obvious.
I also have the bug. Anyone have any idea???
@phamdohung161, hello! I couldn't find a solution to this problem, so I had to figure out how to change the project structure to get it working. And it seems to me that the new structure turned out to be much more convenient than the old one. The most important thing is that I do not have a folder of pages, all routes are written manually, so it may not work for you, but if you are interested, I will try to find the time and put it on the github.
Sorry for my English 馃槉
@zabavnikov I found a trick to resolve the issue. It's working fine.
const sourceStore = path.resolve(process.cwd(), 'app/shared/store');
const targetStore = path.resolve(process.cwd(), 'app/desktop/store');
try {
fs.unlinkSync(targetStore);
} catch (ex) {
if (ex.code !== 'ENOENT') {
throw ex;
}
}
try {
fs.symlinkSync(sourceStore, targetStore);
} catch (ex) {
if (ex.code !== 'EEXIST') {
throw ex;
}
}
Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:
Issues that are labeled as pending will not be automatically marked as stale.
I'm getting a similar error. My project is a mono repo containing multiple nuxt applications with a /core package which is a Nuxt module that shares common logic between apps.
The structure looks like this:
/app-1
nuxt.config.js
/app-2
nuxt.config.js
/core
/layouts
index.js
In my case, I want all apps to load layouts from ../core/layouts, but I get the following error
path should be a path.relative()d string, but got "../core/layouts/default.vue"
This was working before I upgrade Nuxt from v2.11.0 to v2.14.7. So It looks like, now files must be included in the app directory. Why this restriction?
we are having the same problem.. we have multiple nuxt applications on the same repo and we are linking the layouts folder and so outside the folder of the nuxt.config.js file.. anyone knows a workaround that works for this?
@joelcorominas I don't know exactly your use case for sharing layouts between apps. In our case, it was for providing a context to all components (provide/inject). So as a workaround, each nuxt application needs to create his own layouts/default.vue and integrate the shared logic using a <app-provider> component
// layouts/default.vue
<template>
`<!-- registered globally by the "shared" module -->`
<app-provider>
<nuxt />
</app-provider>
</template>
I was not entirely convinced by linking the layouts folder from another package. Does it mean an app cannot define other layouts?
So I think this solution is a bit more repetitive but more explicit and flexible: Apps can define other layouts or even extend the default one.
The issue comes from the node-ignore package - specifically this convention (and of course you are welcome to raise an issue there).
For Nuxt 3, we have an RFC for pluggable child apps that may solve this issue completely.
However, for now you can work around this by pinning ignore@^4.0.6 in your package.json (assuming you're using yarn):
{
"dependencies": {
"nuxt": "^2.13.2"
},
"resolutions": {
"ignore": "4.0.6"
}
}
See working example here.
Most helpful comment
I'm having the same issue. I have two configurations and my application started presented this issue.