Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Npm script fails - '.' is not recognized as an internal or external command

Tags:

node.js

npm

This is the error log

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prestart: `sequelize db:migrate  && ./node_modules/.bin/sequelize db:seed:all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prestart script.

Here is the script

    "lint": "eslint",
    "test": "export NODE_ENV=test && mocha --timeout 100000",
    "prestart": "./node_modules/.bin/sequelize db:migrate  && ./node_modules/.bin/sequelize db:seed:all",
    "start": "./node_modules/pm2/bin/pm2 start pm2server.config.js",
    "poststart": "./node_modules/pm2/bin/pm2 log HumanR" 
like image 412
Yhomi Avatar asked Nov 28 '25 02:11

Yhomi


1 Answers

You're on Windows, but trying to run a script designed for linux (it has linux path separators, which confuse Windows).

Inside an npm script, you can refer to locally installed package binaries by name. Doing so will eliminate your path issue.

    "test": "export NODE_ENV=test && mocha --timeout 100000",
    "prestart": "sequelize db:migrate  && sequelize db:seed:all",
    "start": "pm2 start pm2server.config.js",
    "poststart": "pm2 log HumanR" 

You might also run into an issue with the export NODE_ENV=test command. You'll need cross-env for that.

npm install --save-dev cross-env

Then in package.json:

    "test": "cross-env NODE_ENV=test mocha --timeout 100000",
like image 191
Codebling Avatar answered Nov 30 '25 23:11

Codebling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!