Vue-storefront: Error: Cannot find module '@vue-storefront/i18n/scripts/translation.preprocessor.js'

Created on 4 Jan 2019  路  9Comments  路  Source: DivanteLtd/vue-storefront

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. (/home/shelly/project/vue-storefront/core/build/webpack.base.config.js:27:33)
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.

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.

All 9 comments

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:

  1. In webpack.base.config.ts change these to correct paths:
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
)
  1. Make require('@vue-storefront/...') work by using solution 0 here:
    https://gist.github.com/branneman/8048520
    in package.json add
  "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.

Thanks for sharing the solution with us :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vishal-7037 picture vishal-7037  路  5Comments

JuliaBonita picture JuliaBonita  路  5Comments

slightlyoff picture slightlyoff  路  3Comments

ArjanStudent picture ArjanStudent  路  3Comments

sandermangel picture sandermangel  路  5Comments