Heroku failed to push - node.js

I want to deploy my project on Heroku but when I do it, I have this error :
npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR!
npm ERR!
npm ERR! Invalid: lock file's fs#0.0.1-security does not satisfy fs#*
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.3oo5n/_logs/2021-11-25T14_47_03_365Z-debug.log
-----> Build failed
Even when I delete "package-lock.json" and make "npm install", it still doesn't work.
This is the first time that I have this problem with Heroku deployment, I don't know what can I do about it.
Thank you for your help.

I was having the same issue and it was working at first then it stopped. Deleting the packages-lock.json file and then re-running npm install wasn't working. Strangely it did work if I just removed packages-lock.json but that wasn't the ideal solution.
Finally, I did get it to work by following:
delete my packages-lock.json file
delete node_modules
re-run npm install

Related

Cannot find module typescript.js after Windows restoration point. I'm triying to build my angular app

I had problems with my PC and I restored windows to and old restoration point.
After this... When I try to build my Angular App I have the next error:
C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp>npm run build
> paises-app#0.0.0 build C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp
> npm run config -- --environment=prod && ng build --prod
> paises-app#0.0.0 config C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp
> ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"
internal/modules/cjs/loader.js:329
throw err;
^
Error: Cannot find module 'C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp\node_modules\typescript\lib\typescript.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:321:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:534:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.resolve (internal/modules/cjs/helpers.js:98:19)
at loadCompiler (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:208:34)
at create (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:213:28)
at Object.register (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:184:21)
at main (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js:129:29)
at Object.<anonymous> (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js:448:5)
at Module._compile (internal/modules/cjs/loader.js:1085:14) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Udemy\\AngularDeCeroAExpertoEdicion2021\\03-paisesApp\\node_modules\\typescript\\package.json',
requestPath: 'typescript'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paises-app#0.0.0 config: `ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paises-app#0.0.0 config 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\myuser\AppData\Roaming\npm-cache\_logs\2021-08-01T08_27_09_159Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paises-app#0.0.0 build: `npm run config -- --environment=prod && ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paises-app#0.0.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! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2021-08-01T08_27_09_186Z-debug.log
I think that the problem is with the directory:
C:\Users\myuser\AppData\Roaming\npm\node_modules\
What can I do?
remove the folder node_modules?
reinstall npm?
I tried with npm install and all is ok.
Thanks.
Edited:
Maybe the problem was in my merged branches or something like that.
Since you have not specified what was the installed state of apps when the restoration point was lastly set, I presume that you have all the npm packages captured correctly at that point. If so, try doing the below steps...
Since you have not included the entire log with this, I can guess it is possibly an ambiguity issue due to references not properly resolved!
Open command prompt/powershell/terminal, etc. with admin privilege. Do as below (sudo command not to be used with Windows OS): -
sudo npm cache clean --force
sudo npm cache verify
Delete the package-lock.json file located at C:\Users\<your_username>
Try installing your project dependencies now from your project folder with npm i or yarn install (if you're using yarn as your preferred package manager).
Note: - If this doesn't work, follow the same process as above (again) and uninstall npm/yarn and node and reinstall it. It should work then!
I have fixed it by doing the following:
Remove the folder /node_modules of my Angular App.
Run npm install.
And then run npm run build or npm run start or ng serve.
I have also found a package that does the same. The package name is reinstall
reinstall
Reinstall package's node modules without cache.
Removes node_modules directory
Clean's NPM cache
Install's modules from package.json
npm install reinstall -g
Once installed remember restart your terminal and run reinstall in your root dir.
Maybe the problem was in my merged branches or something like that.

React JS creation problems

Trying to create a new react JS project.
I keep getting this error.
Get the same error when using Visual Studio code, as well.
npm ERR! code EIO
npm ERR! syscall mkdir
npm ERR! path C:\Users\James\Desktop\School\x\my-app\node_modules\.staging\#babel\plugin-transform-for-of-b2ccfdcc
npm ERR! errno -4070
npm ERR! EIO: i/o error, mkdir 'C:\Users\James\Desktop\School\x\my-app\node_modules\.staging\#babel\plugin-transform-for-of-b2ccfdcc'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\James\AppData\Roaming\npm-cache\_logs\2020-09-19T07_50_10_955Z-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 my-app/ from C:\Users\James\Desktop\School\x
How do I solve this?
According to this github issue, you need to:
uninstall node js and delete all its files in local and cache and all
the node modules and npm and npm cache folder in this directory.
After it done, you just need to reinstall the npm, this should do the job.

Getting error while installing react-stripe-js in my react Project

Getting this error on trying to install npm install #stripe/react-stripe-js.
Can anyone help ?
C:\Users\Ayush\Desktop\ReactBootcamp\amazon-clone>npm install #stripe/react-stripe-js
npm ERR! Object for dependency "#babel/generator" is empty.
npm ERR! Something went wrong. Regenerate the package-lock.json with "npm install".
npm ERR! If using a shrinkwrap, regenerate with "npm shrinkwrap".
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ayush\AppData\Roaming\npm-cache\_logs\2020-09-11T07_04_49_530Z-debug.log
enter image description here
try below steps
Delete node_modules folder
Delete package-lock.json file
run npm cache clean --force
npm install

error: This is probably not a problem with npm. There is likely additional logging output above

In my project, I'm using Angular6 for the frontend. Now what I'm trying to do is deploy my project which is in remote server into the actual server. I'm using npm run build -prod command to build the frontend first. But I can't build my project since the following error occurs again and again,
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Trackit-Revamp#6.0.0 build: `ng build --prod --build-optimizer --aot`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the Trackit-Revamp#6.0.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! C:\Users\Indrajith.E\AppData\Roaming\npm-cache\_logs\2019-08-22T08_41_00_271Z-debug.log
My error log in the C:\Users\Indrajith.E\AppData\Roaming\npm-cache\_logs\2019-08-22T08_41_00_271Z-debug.log file path contains the same error details mentioned above.
How can I resolve this problem?
Delete your package-lock.json file and node_modules folder.
Then do npm cache clean
npm cache clean --force
do
npm install
again and run
Finally, I found a solution to this problem without reinstalling npm and I'm posting it because in future it will help someone,
Most of the time this error occurs javascript heap went out of the memory. As the error says itself this is not a problem with npm. Only we have to do is
instead of,
npm run build -prod
extend the javascript memory by following,
node --max_old_space_size=4096 node_modules/#angular/cli/bin/ng build --prod
Please delete package-lock.json and clear npm cache with npm cache clear --force
and delete whole node_modules directory
Finally install or update packages again with npm install / npm update
You can also add any new packages with npm install <package-name>
This fixed for me.
Thanks and happy coding.
I'm on Ubuntu 18.04. I fixed this problem by increasing the inotify max_user_watches using this command:
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
I'm new with react... Well i had the same output:
Starting the development server...
events.js:196
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/opt/lampp/htdocs/react-tuto/public'
at FSWatcher.<computed> (internal/fs/watchers.js:168:26)
at Object.watch (fs.js:1351:34)
at createFsWatchInstance (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqCallback.oncomplete (fs.js:165:5)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[... lines matching original stack trace ...]
at FSReqCallback.oncomplete (fs.js:165:5) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/opt/lampp/htdocs/react-tuto/public',
filename: '/opt/lampp/htdocs/react-tuto/public'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-tuto#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-tuto#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! /home/paulo/.npm/_logs/2019-12-16T16_46_27_856Z-debug.log
I just tried:
sudo npm start
And it worked.
I already have the same problem . and I fix it using npm update & npm cache clean --force
Delete node_modules
rm -r node_modules
install packages again
npm install
Delete node_module directory and run below in command line
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
If still not working, try below
npm install webpack --save
For me, the problem was in firebase.json, the site name was incorrect.
For the people it didn't work, I spent two days finding the solution and there was just one command that worked like a magic.
npm install -g live-server
and then run: npm start
it will start as normal.You can read all the details here https://www.npmjs.com/package/live-server
Deleting the package-lock.json did it for me. I'd suggest you not push package-lock.json to your repo as I wasted hours trying to npm install with the package-lock.json in the folder which gave me helluva errors.
Check if port you want to run your app is free. For me, it was the problem.
Following steps solves my problem:
Add "C:\Windows\System32\" to your system path variables
Run npm eject,
Run npm start,
Run npm eject,
and agian run
npm start
And it worked😊
For me, I was trying to install an old version of bcrypt which was not found in npm, I just edited package.json and manually put the latest version and then ran npm install and it worked
first delete the file (project).
then rm -rf \Users\Indrajith.E\AppData\Roaming\npm-cache_logs\2019-08-22T08_41_00_271Z-debug.log (this is the file(log) which is showing error).
recreate your project for example :- npx create-react-app hello_world
then cd hello_world.
then npm start.
I was also having this same error but hopefully after spending 1 day on this error i have got this solution and it got started perfectly and i also hope this works for you guys also...
I had encountered the same error. And, I just simply deleted the whole node_modules folder, and installed the npm packages again solved my error.
Delete node_modules (don't worry you have package.json)
npm install
Novice mistake. Make sure your package.json file is coded correctly. I had:
"start": "index node.js"
instead of:
"start": "node index.js"
17
Delete your package-lock.json file and node_modules folder. Then do npm cache clean
npm cache clean --force
do npm install
I just do two steps:
first:
export METEOR_ALLOW_SUPERUSER=true;
second:
sudo systemctl stop bbb-html5
and finally:
npm start
My project is on wagtail. I solved this problem by running the following command:npm update & npm cache clean --force
I had the issue in React. In my case it was happening, because I didn't see warnings/errors above the message. After fixing the issues, everything worked properly. Hopefully it's going to help someone.
On Ubuntu, I restarted the server and the problem was solved.
For me, it happens because of the low version of Node. Upload my Node version and it worked successfully.

How to start project node.js error with name

I need start the project https://github.com/oracle/bots-node-sdk and I don`t know a lot of node.js. I try follow the instructions, but I receive the errors.
npm install #oracle/bots-node-sdk
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "#oracle/bots-node-sdk" under a package
npm ERR! also called "#oracle/bots-node-sdk". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\josiv\AppData\Roaming\npm-cache\_logs\2019-02-05T16_16_57_042Z-debug.log
I already try change name in file package.json and also I try command: npm init "other_name" and always the same error.
Edit:
I change name in file package.json and run npm install #oracle/bots-node-sdk. After run npx #oracle/bots-node-sdk init with successful:
---------------------------------------------------------------------
Custom Component package 'bots-node-sdk-master' created successfully!
---------------------------------------------------------------------
Usage:
npm start Start a dev server with the component package
PS D:\Fontes\OracleDigitalAssistant-Bot\bots-node-sdk-master> npm start
> bots#2.1.3 start D:\Fontes\OracleDigitalAssistant-Bot\bots-node-sdk-master
> npm run bots-node-sdk -- --service .
> bots#2.1.3 bots-node-sdk D:\Fontes\OracleDigitalAssistant-Bot\bots-node-sdk-master
> bots-node-sdk "--service" "."
It is saying there's a conflict with your project name and the dependency you're trying to install.
In your package.json, if the name property is "#oracle/bots-node-sdk" then change it to someone else and then run npm install #oracle/bots-node-sdk again.
Alternatively you can just delete the package.json file and then run npm init -y.

Resources