npm-pdfreader icon indicating copy to clipboard operation
npm-pdfreader copied to clipboard

'ava' is not recognized as an internal or external command - When testing compatibility

Open litehacker opened this issue 2 years ago • 5 comments

Describe the bug Following the installation and testing process leads to the error:

'ava' is not recognized as an internal or external command,

To Reproduce Followed the installation process after creating clean node.

package.json

{
  "name": "backend",
  "version": "0.0.1",
  "description": "Uses `pdfreader` [package](https://www.npmjs.com/package/pdfreader)",
  "main": "index.js",
  "scripts": {
    "start:dev": "nodemon",
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "rimraf ./build && tsc",
    "start": "npm run build && node build/index.js"
  },
  "author": "Giorgi Gvimradze",
  "license": "ISC",
  "devDependencies": {
    "@tsconfig/node14": "^1.0.1",
    "@types/node": "^14.18.20",
    "nodemon": "^2.0.16",
    "rimraf": "^3.0.2",
    "ts-node": "^10.8.0",
    "typescript": "^4.7.2"
  },
  "dependencies": {
    "pdfreader": "^2.0.0"
  }
}

Expected behavior I expect it to pass the test. since it's required node v 14, I got it.

Screenshots, outputs, or logs

PS C:\<DIRECTORY>\backend\node_modules\pdfreader> npm test
>>

> [email protected] test C:\<DIRECTORY>\backend\node_modules\pdfreader
> ava

'ava' is not recognized as an internal or external command,

Desktop:

  • OS: Windows 10
  • Node v: 14.17.3
  • npm v: 6.14.13
  • package v: 2.0.0

litehacker avatar Jun 03 '22 11:06 litehacker

Hi!

Indeed, the testing instructions are incorrect. ava is a development dependency of pdfreader, so it's not installed when you add pdfreader as a dependency of your own project.

Can you try running them with the command npx ava (instead of just ava) and tell me if it works, please?

Adrien

adrienjoly avatar Jun 03 '22 12:06 adrienjoly

Hello. I tested with npx ava but only got × Couldn’t find any files to test. Same result when I do npm install inside the "node_modules/pdfreader" folder.

  • Windows 10
  • Node 16.10.0
  • npm 7.24.0

bhdzllr avatar Aug 09 '22 05:08 bhdzllr

Even if you run npx ava from the pdfreader directory?

adrienjoly avatar Aug 11 '22 07:08 adrienjoly

Even if you run npx ava from the pdfreader directory?

Yes. Tried npx ava insdie "node_modules/pdfreader". Same result.

Just realised there is no "test" folder inside "node_modules/pdfreader", because its listed in ".npmignore" to reduce package size.

bhdzllr avatar Sep 26 '22 07:09 bhdzllr

Just realised there is no "test" folder inside "node_modules/pdfreader", because its listed in ".npmignore" to reduce package size.

Good catch! That makes sense, as test files are not needed by projects that rely on pdfreader as a dependency.

If you need to run pdfreader's tests, you need to git clone https://github.com/adrienjoly/npm-pdfreader.git.

adrienjoly avatar Sep 28 '22 15:09 adrienjoly