npm cannot find index.html when launching REACT front end - node.js

The problem occurs when I try to launch the front end of the app. I do this from within the frontend directory with the command: npm start. It is a MERN stack application. I am using git for version control. Others with access to the git can run npm start with no problems on their machines, so I think the problem could be related to the windows file or path systems, but haven't been able to find out.
The error given:
Could not find a required file.
Name: index.html
Searched in: C:\Users\Liam\OneDrive\Desktop\COP4935\Project\DemocracyToken\public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend#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! C:\Users\Liam\AppData\Roaming\npm-cache\_logs\2021-09-03T17_01_09_900Z-debug.log
npm appears to be trying to access the public directory from the project root (DemocracyToken) when the public directory is located in DemocracyToken/frontend/
I have tried:
rerunning npm install,
uninstalling and reinstalling node,
moving the location of the public folder,
and moving the location of index.html.
Here is the file structure of our app:

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!

Npm React js start error - ELIFECYCLE ERRNO1

The system cannot find the path specified.
npm ERR!
code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-able-pro#1.0.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-able-pro#1.0.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:
ive got some error when i npm start, it always like this when i restart my pc,
ive already use
npm cache clear --force
deleting my modules app and package-lock.jason
npm install
and its doesnt work at all, can you guys help me ?
The library that you are trying to run is "react-able-pro". Through a search on www.npmjs.com for this library, I was not able to find it. However I was able to find react-table-pro.
It looks like a typo. try to fix your package.json file dependencies/devDependencies and then try to reinstall

Angular npm link throws 404 while linking local dependency lib

As the title says, creating a link with the dependency (it shows inside my global node folder). However I am using nvm-windows which creates separate folders fore each version which may cause some issues but reading about this issue the env var NVM_SYMLINKS used to fix this.
Env variables contains NVM_SYMLINKS and it points to a nodejs installation at my main drive which according to other issues is fine.
$ npm start
> own-webpage#0.0.0 start C:\PROJECTS\HMR\HKIR\hkir\hmr\bo\frontend
> npm link lib-hkir-common-client-bo && ng serve
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/lib-hkir-common-client-bo - Not found
npm ERR! 404
npm ERR! 404 'lib-hkir-common-client-bo#latest' is not in the npm 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\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_833Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! own-webpage#0.0.0 start: `npm link lib-hkir-common-client-bo && ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the own-webpage#0.0.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! C:\Users\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_877Z-debug.log
Running node -v in both directories shows that both of them are using the same versions.
I've tried deleting both node_modules, package-locks, removing the smylink from the main global recreating said symlink. But nothing seems to work.
When creating the link via npm link inside the dependency it prints out the following symlink pattern:C:\Program Files\nodejs\node_modules\lib.hkir.common.client.bo -> C:\PROJECTS\HMR\HKIR\hkir\lib.hkir.common.client.bo which once again according to others is completely fine.
How can I fix the issue so my project sees and uses the linked dependency?
Thanks.

react scripts not found

I have a problem running npm start from my newly created project, the thing is the problem doesn't seem to occur outside of this folder (its a git repo, so it needs to be in here). If i create a new project in another folder and run npm start I have no issues at all.
So I recently started working in Ubuntu 18.04LTS, gone through all the setup of installing nodejs and npm.
Currently running versions:
node = 10.16.0
npm = 6.9.2
So I created my app by using npx create-react-app
When i run npm start inside this, it throws me an error:
sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! frontend#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the frontend#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
I tried create the app in another folder, testing if i can run npm start (yes) and the move this app to my repo, but then it fails again.
If i understand well what you wrote, "npm start" worked fine when you changed folders. If this is the case, you should know that Node has issues reading the path when some particular characters (like "&") or spaces are in the name of a folder.
Try to change the folder's name.

Resources