yarn run v1.12.3
$ node ./core/scripts/entry
module.js:544
throw err;
^
Error: Cannot find module '@vue-storefront/i18n/scripts/translation.preprocessor.js'
at Function.Module._resolveFilename (module.js:542:15)
at Function.Module._load (module.js:472:25)
at Module.require (module.js:585:17)
at require (internal/module.js:11:18)
at Object.
at Module._compile (module.js:641:30)
at loader (/home/shelly/project/vue-storefront/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/shelly/project/vue-storefront/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Which node.js version? Should be latest LTS, right now 10.15.0
Try to run yarn install before running other commands
this also happens AFTER running npm install/ yarn install
@pkarw Got same error. Here's how I fixed it:
const translationPreprocessor = require('@vue-storefront/core/i18n/scripts/translation.preprocessor.js')
translationPreprocessor(
[path.resolve(__dirname, '../../core/i18n/resource/i18n/'), path.resolve(__dirname, themeResources + '/i18n/')],
config
)
"dependencies": {
...
"module-alias": "2.x.x",
...
},
...
"_moduleAliases": {
"@vue-storefront": "./"
},
In webpack.base.config.ts (and maybe others) add
require('module-alias/register')
Thanks, do You think it's a general solution that should be provided as a PR to the core?
@panique @fancydev18 @shelly28 could you please provide steps of a minimal reproduction including information about code, yarn and node version you are using?
Actually, I've used npm instead of yarn. That's why it doesn't work, as it doesn't support "workspaces". I've commented what I learned here: https://gist.github.com/branneman/8048520
The simplest solution would be to keep using yarn for now, until npm supports workspaces too.
"module-alias" solution would add extra complexity.
Feel free to close this. At least others trying npm would know why it doesn't work.
Thanks for looking into it.
Looks like workspaces are planned for npm too: https://blog.npmjs.org/post/173239798780/beyond-npm6-the-future-of-the-npm-cli
Thanks for sharing the solution with us :+1:
Most helpful comment
Actually, I've used npm instead of yarn. That's why it doesn't work, as it doesn't support "workspaces". I've commented what I learned here: https://gist.github.com/branneman/8048520
The simplest solution would be to keep using yarn for now, until npm supports workspaces too.
"module-alias" solution would add extra complexity.
Feel free to close this. At least others trying npm would know why it doesn't work.
Thanks for looking into it.