Skip to content
Advertisement

bin is not recognized as an internal or external command. npm script

I’m new to node/npm and having an issue trying to start an npm script.

When I try to run a basic script like the one belown, it gives me the error “bin is not recognized as an internal or external command”. I think i have had already run succesfully some previous script I made so I don’t know if wether my npm is broken or if I did something wrong.

#! node

const app = require('../lib/app')
const config = {
  port: 8080
}

app.listen(config.port, () => {
  console.log(`Chat is waiting for you at http://localhost:${config.port}`)
})

Screenshot bin error

I have already tried uninstal – reinstall it. I also checked this post: npm bin command – not recognized as an internal or external command and tried to run npm install -g unsucessfully.

I’m on Windows.

Advertisement

Answer

Nevermind.

I just understand what happend. The code was inspired from a Linux user which had the “! env node” on the first line.

I’m on Windows so I removed it but as a result, the script was just trying to run “bin/start” instead of “node bin/start”.

Ridiculous error but well, at least i’ve learned something

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement