mxmvshnvsk / i18n-unused

The static analyze tool for finding, marking and removing unused and missing i18n translations in your JavaScript project
MIT License
128 stars 21 forks source link

Can't start #3

Closed Jennetiero closed 3 years ago

Jennetiero commented 3 years ago

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

mxmvshnvsk commented 3 years ago

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

Jennetiero commented 3 years ago

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

mxmvshnvsk commented 3 years ago

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

Jennetiero commented 3 years ago

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

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

mxmvshnvsk commented 3 years ago

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.

mxmvshnvsk commented 3 years ago

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

sethomas commented 3 years ago

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

mxmvshnvsk commented 3 years ago

@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.