postgrator: not found while migrating postgresql database - database

Error:
$ heroku run npm run migrate
Running npm run migrate on ⬢ shelly-moth-73910... up, run.3979 (Free)
> noteful-app-server#1.0.0 migrate /app
> postgrator --config postgrator-config.js
sh: 1: postgrator: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! noteful-app-server#1.0.0 migrate: `postgrator --config postgrator-config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the noteful-app-server#1.0.0 migrate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2020-09-06T07_52_36_217Z-debug.log
postgrator-cli version 4.0.0 is installed on repo, running npm list postgrator-cli tells me that. But after I push to heroku it's as though postgrator doesn't exist. heroku run npm install postgrator-cli and other such commands don't change, and heroku run npm list postgrator-cli returns:
$ heroku run npm list postgrator-cli
Running npm list postgrator-cli on ⬢ rocky-garden-73910... up, run.7024 (Free)
noteful-app-server#1.0.0 /app
`-- (empty)
Here's my postgrator-config.js
require('dotenv').config();
module.exports = {
'migrationsDirectory': 'migrations',
'driver': 'pg',
'connectionString':
process.env.NODE_ENV === 'test'
? process.env.TEST_DATABASE_URL
: process.env.DATABASE_URL,
'ssl': !!process.env.SSL,
};
Procfile contains web: node src/server.js

I just had the same error.
In my package.json I found that it was in my "devDependencies", not my "dependencies".
When I first installed it, I ran npm i postgrator-cli -D, making it a development dependency. When I tried installing it again without the -D it didn't do anything, so I deleted it from my package.json.
Then, I ran npm i postgrator-cli and checked my package.json and found that it was in my dependencies. I git added, committed, and pushed to heroku and then I ran heroku run npm run migrate - it worked!

Related

cannot setup react-boilerplate on mac M1

when I clone the repository and run this command "npm run start", this error occurs
npm ERR! code 1
npm ERR! path /Users/hf/Downloads/leadbook-test/node_modules/ngrok
npm ERR! command failed
npm ERR! command sh -c node ./postinstall.js
npm ERR! ngrok - platform darwinarm64 is not supported.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hf/.npm/_logs/2022-03-09T19_45_14_908Z-debug-0.log
Try
npm cache clean --force
After that delete node_modules and package-lock.json
npm install or yarn
npm start or yarn start
Hope this will fix your issue.

Vercel React.js Deployment: Cannot find module: 'firebase'. Make sure this package is installed

I deployed a react app to Vercel that uses firebase. The build exits with status code 1.
I have installed firebase using: "npm install firebase" and it is running well on the local environment. What would be the possible error?
Creating an optimized production build...
Failed to compile.
./src/firebase.js
Cannot find module: 'firebase'. Make sure this package is installed.
You can install this package by running: npm install firebase.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! neozon#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appname#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2022-01-11T18_49_38_751Z-debug.log
Error: Command "npm run build" exited with 1
My guess is that the firebase package isn't installed on the server (unlike on your local environment), which most likely reads the dependencies from the package.json.
To add firebase to your package.json on your local system, run:
npm install firebase --save

getting error while trying to create a react app

I used to create react apps with the facebook's github repo and it worked each time, but this time it is not working. Because I'm getting this error and I can't find the reason behind it. I've already tried to do the cache clean.
> core-js#2.6.12 postinstall C:\Users\user\Desktop\cryptohello\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! core-js#2.6.12 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the core-js#2.6.12 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-08-15T16_48_09_293Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting cryptohello/ from C:\Users\user\Desktop
Done.
The problem is you haven't support of fork, exec and bash in cmd in windows, please try with GIT Bash

npm start suddenly stops working on react app

I've been learning react for about two weeks, when suddenly npm start won't run. This is what I get instead:
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! recipe-app#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the recipe-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Michelle/.npm/_logs/2020-07-29T14_35_20_988Z-debug.log
After a ton of googling I tried
npm install -g npm#latest but the permission was denied.
Deleted and reinstalled node several times, tried using Homebrew, etc, but nothing worked.
Edit: Found the solution!
Npm couldn't find react-scripts, so I had to change the scripts in package.json to
"start": "node_modules/react-scripts/bin/react-scripts.js start".
You need to install react-scripts
npm install react-scripts
The first line of the logs you just sent indicates your computer doesn't know the command react-scripts.
It means you need to install it.
When you use the -g option with npm install, it means you want to install globally the package, setting the package accessible for every user on your computer. That's why you have a permission error. You can solve this by adding sudo before the command maybe or running it with a elevated user.
It's not mandatory to install the package globally.
I suppose your package.json file contains a script named start starting with react-scripts.
If you install the react-scripts package with npm install react-scripts, you'll find the binary under node_modules/.bin/react-scripts.
Then you can replace in your start script configuration react-scripts with ./node_modules/.bin/react-scripts.
An example of a package.json file:
{
"name": "myapp",
"version": "1.0.0",
...
"scripts": {
...
"start": "./node_modules/.bin/react-scripts [...]",
...
},
...
}
running "npm install react-scripts" even if I had before, worked for me

laravel react command run dev not working

C:\wamp64\www\want>npm run dev
> # dev C:\wamp64\www\want
> npm run development
> # development C:\wamp64\www\want
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
The system cannot find the path specified.
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn node_modules\webpack\bin\webpack.js ENOENT
at notFoundError (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
Emitted 'error' event at:
at ChildProcess.cp.emit (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\coolm\AppData\Roaming\npm-cache\_logs\2018-09-18T16_07_49_646Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\coolm\AppData\Roaming\npm-cache\_logs\2018-09-18T16_07_49_686Z-debug.log
C:\wamp64\www\want>
I'm trying to hook up my Laravel application with React. I followed the step of running the command "php artisan preset react" but after I was instructed to run npm install & run dev. I keep getting the following error. Does anyone have a similar problem?
Try doing full reset:
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

Resources