mxmvshnvsk/i18n-unused

Can't start

Jennetiero opened this issue · 8 comments

tried all commands, but everytime i get this:
'i18n-unused' is not recognized as an internal or external command,
operable program or batch file.

@Jennetiero. Hi. Which version you use? And how did you setup?

first of all i installed with "yarn add --dev i18n-unused". then added i18n-unused.config.js file to root folder with these code:
module.exports = { // array of files extensions, like ['js', 'vue'] extensions: ['js', 'ts', 'jsx', 'tsx', 'vue'], // array of extensions of locales files, like ['js', 'json'] localesExtensions: ['json'], // path where analyze files srcPath: 'src', // path, where plased locales files localesPath: 'src/i18n/ru.ts', // if substring contain key, it'll ignore excludeKey: '.props.', // custom marker for unused translations marker: '[UNUSED]', // check git log status gitCheck: false };
I use 0.0.8 version

So. Your error looks like Windows problem with cmd node running. By default (from cmd for example) it may haven't a link on the system. It means that cmd will not resolve paths to node_modules. You can try run node ./node_modules/i18n-unused

so, i got this:
`internal/modules/cjs/loader.js:969
throw err;
^

Error: Cannot find module 'fs/promises'
Require stack:

  • C:\Users\User\Desktop\workspace\stat-tm\node_modules\i18n-unused\dist\i18n-unused.umd.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\User\Desktop\workspace\stat-tm\node_modules\i18n-unused\dist\i18n-unused.umd.js:2:98
    at Object. (C:\Users\User\Desktop\workspace\stat-tm\node_modules\i18n-unused\dist\i18n-unused.umd.js:5:2)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\User\Desktop\workspace\stat-tm\node_modules\i18n-unused\dist\i18n-unused.umd.js'
    ]
    }
    `

I think u work in VSCode. Add to your package.json to scripts path run command, for example: "unused": "i18n-unused", and after run npm run unused.

@Jennetiero or you can try npx i18n-unused, it resolve node_modules/.bin. If it helps, than close issue.

Had this same error around fs/promises, it was since I was using Node 12, to use this package you MUST be on greater than Node 14 since fs/promises was exposed starting at that version:
https://nodejs.org/api/fs.html#fs_promises_api

@sethomas hi. In the next minor version, I will make normal compatibility with different node versions. For now 14+ are required. I think I'll publish an update next week.