Parcel command not found - node.js

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.

Related

Nestjs failed to deploy on cpanel

I'm trying to deploy my backend application on cpanel and I'm getting an error like this
what should i do to solve this problem?
> test3#0.0.1 start /home/nandaken/inventory
> nest start
stderr:
npm WARN lifecycle The node binary used for scripts is /home/nandaken/nodevenv/inventory/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: nest: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test3#0.0.1 start: `nest start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test3#0.0.1 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/nandaken/.npm/_logs/2023-01-28T08_16_43_494Z-debug.log
Looks like cpanel is calling the startscript which is running nest start. More than likely, you only have production dependencies installed, so #nestjs/cli isn't installed because it is a devDependency. Either configure cpanel to call a different start script (like start:prod which should map to node dist/main) or change your start script to run the proper js file (like node dist/main). The other option would be to install #nestjs/cli as a production dependency, but I wouldn't suggest that

NextJS not running on MacOS even after installing modules

So I've just created a NextJS project using create-next-app which went smoothly as expected. Then ran npm i just to be sure and saw all modules installed into node_modules
When I try to run npm run dev to start my nextjs app. it just says
sh: next: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test#0.1.0 dev: `next dev`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test#0.1.0 dev 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/john.v.n.pakson/.npm/_logs/2022-10-06T08_01_29_725Z-debug.log
It seems like npm is not detecting the node_modules i have installed.
Not sure if this is a mac or a zsh issue.
I'm using node version 12.22.12
Upgraded to 16.17.1 and still see the same error
> test#0.1.0 dev
> next dev
/var/folders/6y/xtlzp4z16dj0stxnqx8znj8w0000gn/T/dev-01c08137.sh: line 1: next: command not found
Okay I figured it out. It was caused by my file path on macos. My project was on a folder called Project/Test which might have confused zsh or mac. This in turn caused npm to not be able to find the correct scripts on my node_modules
When I moved my project to another folder I was already able to run npm run dev properly.
Cheers!

npx start, npx install npx init is not working

I have been working with react for years using NPX and yarn and I just got assign to built an app with react-native using react native-cli so i tried setting up my environment using the react native docs and some YouTube videos. But after following the instructions like downloading android studios and adding in my new environment variable, I'm getting an error every time i tired to run
"npx react-native init AwesomeProject" which gave me this error
[![npx react-native init result][1]][1]
I also tried npm install and i got this error on git bash and also on my commandline
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Dennis\Desktop\GitHub\LCRN01-travel-onboarding-app-master\LCRN01-travel-onboarding-app-master\node_modules\core-js
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dennis\AppData\Local\npm-cache\_logs\2021-11-13T05_50_35_592Z-debug.log```
and also npx react-native start is showing this error on git bash
```openssl config failed: error:02001003:system library:fopen:No such process
Command `start` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.```
I have tried running "npm cache clean --force"
but still nothing changed
I can't even run npx create-react-app anymore because i keep getting this error
npx creat-react-app test
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/creat-react-app - Not found
npm ERR! 404
npm ERR! 404 'creat-react-app#latest' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dennis\AppData\Local\npm-cache_logs\2021-11-13T06_05_46_068Z-debug.log
I'm currently using a windows 10 device
node -v 16.13.0
npm -v 8.1.3
[1]: https://i.stack.imgur.com/OTLYj.png
It's create-react-app.
Not totally sure but another issue could be that your Git bash isn't in your PATH.
Plus, npx start and npx install doesn't sound right, maybe you meant npm start and npm install.
On top of that, it seems you have node v11 and not node v16, maybe you have different versions of node, some in Windows' PATH and some only accessible from bash.
It could help to clean up and reinstall your node versions and Git bash, also check your environment variables for remnants of previous versions, and make sure to not confuse npm and npx.

Why has my server stopped working after trying to install SCSS?

Currently, I am following a course in React development. As a part of the course, we have to install SCSS to style an e-commerce app. So far, I have tried avoiding SCSS and reformat the code to CSS. However, since there is no $ SCSS equivalent in CSS, I am forced to install SCSS. Nevertheless, after writing
npm add node-sass
I had to restart my server and I got the error stated at the end. In the course, they mention that there might be some bugs and in that case, we should use the following lines
rm -rf npm.lock
rm -rf node_modules
Despite using these lines, my server still will not start and I am still stuck being unable to proceed since I need SCSS to work, and for that, I need my server to work because I need to restart it to install NCSS. In the following lines, I will leave the error message I get when I try to start my server. npm and node are already installed.
aaronserpilin#Aarons-MacBook-Air crown-clothing % npm start
> crown-clothing#0.1.0 start /Users/aaronserpilin/crown-clothing
> react-scripts start
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! crown-clothing#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the crown-clothing#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/aaronserpilin/.npm/_logs/2021-10-02T13_22_23_006Z-debug.log
aaronserpilin#Aarons-MacBook-Air crown-clothing %
what your node-sass version used?
i used node-sass#4.14.1 and react#17.0.0 is work

Error using Framework7 and service.js for hosting in the local host

when i clicked the npm run service. This error is what i am getting
I have used the same app in the following link:
https://github.com/valnub/f7-node-autocomplete-search-demo
framework7-react-app-template#3.0.0 service C:\Users\Tallam Tharun Sai\auto-complete
PORT=3001 nodemon service/service.js
'PORT' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! framework7-react-app-template#3.0.0 service: `PORT=3001 nodemon service/service.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the framework7-react-app-template#3.0.0 service 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\Tallam Tharun Sai\AppData\Roaming\npm-cache\_logs\2020-07-10T18_16_54_175Z-debug.log
The answer for this is.
I have deleted the Package.json and Node modules from the project and again followed the steps to install the npm as (npm install).
Then I have the installed my npm app successfully.

Resources