Error keeps occurring while doing npm run deploy - node.js

When I try npm run deploy, Error occured.
I can't understand error message...
How can I resolve this problem??
> habit-tracker#0.1.0 deploy
> gh-pages -d build
Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the "repo" option).
npm ERR! code 1
npm ERR! path C:\Users\me\react_projects\react-basic\habit-tracker
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c gh-pages -d build
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\me\AppData\Local\npm-cache\_logs\2021-03-22T06_15_37_037Z-debug.log

Related

npm cannot find node on Windows

When I try to build a project with Maven, which calls npm, it fails with such an error message:
[ERROR] npm ERR! code 1
[ERROR] npm ERR! path C:\(path to some node module)
[ERROR] npm ERR! command failed
[ERROR] npm ERR! command C:\windows\system32\cmd.exe /d /s /c node scripts/install.js
[ERROR] npm ERR! 'node' is not recognized as an internal or external command,
[ERROR] npm ERR! operable program or batch file.
The node program is normally present and available from the same terminal. What can cause such an error?
A npm ERR! code 1 usually occurs when npm fails to install a node module. Check the latest version for your module, update it in package.json and run
npm install again. If this doesn't work, you can downgrade your version of npm to a more stable one and try again.

npm install error: cannot find module 'read-package-tree'

executing the npm install command in windows 10 machine .
facing the below issue
C:\ >npm install
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'read-package-tree'
npm ERR! Require stack:
npm ERR! - C:\Users\dineshkumars2\AppData\Roaming\npm\node_modules\npm\lib\install.js
npm ERR! - C:\Users\dineshkumars2\AppData\Roaming\npm\node_modules\npm\lib\npm.js
npm ERR! - C:\Users\dineshkumars2\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dineshkumars2\AppData\Roaming\npm-cache\_logs\2020-12-31T02_21_08_042Z-debug.log
Try installing read-package-tree using npm command as,
npm i read-package-tree
In case same error showing for executing the above command, Please copy the folder from another machine and paste it into the path that where node_modules are in.
Ex:
C:\Users\MyName\AppData\Roaming\npm\node_modules\npm\node_modules
then run the below command npm i read-package-tree it will resolve the issue, now we can able to run the command 'npm install'

Parcel command not found

In my project, I use Parcel to bundle everything. Now, I am at the point where I need to deploy my app.
I clone my git repo with my React app and I put in the Node server.
I tried every command possible to install parcel, but I always get the following error :
> pp-react#0.1.0 build /home/volodymk/react
> parcel build index.html
sh: parcel: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! pp-react#0.1.0 build: `parcel build index.html`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the pp-react#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! /home/volodymk/.npm/_logs/2020-01-12T19_26_22_634Z-debug.log
How can I fix this ?
To run any installed node package (not just Parcel), use npx, the utility command shipped with npm. It executes packages that come with a runtime command in your node_modules/packagename/.bin directories.
As in npx parcel build index.html
More information available in the npx readme.

nightwatch Error "Error: ENOENT: no such file or directory .../examples/pages"

I am starting to use nightwatch (followed this tutorial -
https://blog.risingstack.com/end-to-end-testing-with-nightwatch-js-node-js-at-scale/)
I created a folder in "/Users/luisfranqueira/fyde/experiments"
And inside I have the structure:
/bin /reports /tests nightwatch.json
when running the tests follow all instructions in the tutorial - I run the command "npm run test-e2e"
I get the following error:
> # test-e2e /Users/luisfranqueira
> nightwatch
There was an error while starting the test runner:
Error: Cannot read source folder: /Users/luisfranqueira/examples/tests
at /Users/luisfranqueira/node_modules/nightwatch/lib/runner/run.js:203:21
at /Users/luisfranqueira/node_modules/nightwatch/lib/runner/walk.js:97:18
at FSReqWrap.oncomplete (fs.js:152:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # test-e2e: `nightwatch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # test-e2e 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/luisfranqueira/.npm/_logs/2017-12-05T12_23_49_345Z-debug.log
I know that this is probably a miss configured path, however, I don't know where to change it....

After npm run deploy errors occured

After npm run deploy i have errors like above
Repo on Github
I am trying to deploy my react-app on gh-pages on Github (create-react-app)
'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-world-4#0.1.0 deploy: `npm run build&&gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-world-4#0.1.0 deploy script 'npm run build&&gh-page
s -d build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hello-world-4 package
,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build&&gh-pages -d build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hello-world-4
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hello-world-4
npm ERR! There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jan\AppData\Roaming\npm-cache\_logs\2017-05-12T17_55_00_56
9Z-debug.log
So I run this command npm install --save gh-pages
like below
After that I run the command npm run deploy
My code published successfully like below.
For more details just follow this link by Facebook which is given below.
(https://facebook.github.io/create-react-app/docs/deployment#github-pages-https-pagesgithubcom)
I hope your issue will be resolved. In case of error please reply.
please install gh-pages and it ready to go
To install
npm install gh-pages
to deploy
add this to package.json
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
and then this
npm run deploy
gh pages stands for GitHub Pages. It is simply a way to deploy a website via a github repo. Basically, NPM is yelling because when it attempts to run the command deploy, there is not link or reference to the line
$npm run build&&gh-pages -d build
You need make sure that gh-pages -d build is defined. A place to start would be running gh-pages --man or gh-pages --help
I facing the same problem I do the following command before
git push
not working. After
git push
I do the same command it works correctly.
npm install gh-pages
and deploy
npm run deploy

Resources