So created a simple npm package that can display my details. But when I run it using npx hiruja
it shows a loading bar like thing and then says ‘hiruja’ is not recognized as an internal or external command, operable program or batch file
It work on my iMac 12,1 running Catalina (The computer where I created it)
But it doesn’t work on any other computer including Macs (So the os isn’t the problem)
I checked the file structure and it is fine too.
Also tried npm pkg fix
I made sure I have the node.js upto date and also tested some packages with npx
Please Help.
This is my code:
package.json
{
"name": "hiruja",
"version": "1.2.1",
"description": "Hiruja Edurapola",
"main": "index.js",
"type": "module",
"bin": {
"hiruja": "index.js"
},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": [
"hiruja"
],
"author": "Hiruja Edurapola",
"license": "ISC",
"dependencies": {
"boxen": "^7.1.1",
"chalk-animation": "^2.0.3"
}
}
index.js
#!/usr/bin/env node
import boxen from 'boxen';
import chalkAnimation from 'chalk-animation';
let hiruja = `
Name: Hiruja Edurapola
Email: [email protected]
`
const rainbow = chalkAnimation.rainbow(boxen(hiruja, {padding: 1}));
The actual console.log have some more code including bunch of ascii art.