3

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" 
0

2 Answers 2

7

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",
Sign up to request clarification or add additional context in comments.

3 Comments

i replaced the script with what you gave above, it works well but database does not connect
@Yhomi were you able to get the database to connect?
yes, i had to change the script to the above
-1

Does .bin folder in "./node_modules/.bin/sequelize db:migrate && ./node_modules/.bin/sequelize db:seed:all" exists?

I have something similar in a project, but I do this:

    "db:seed": "npm run _db -- db:seed:all",
    "db:create": "npm run _db -- db:create",
    "db:migrate": "npm run _db -- db:migrate",
    "db:init": "./scripts/create_and_seed_db.sh",
    "_db": "node ./node_modules/sequelize-cli/lib/sequelize",

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.