I don't have a "./bin/www" file - linux

To start things off, please know that I'm incredibly new to the whole web development world, so if I say anything that doesn't make sense, please let me know. So I've been following some guide on how to develop a simple restful app, but I hit a wall when I tried using 'npm start' to set up (the first version of) the restful app. The error says that it can't locate "./bin/www" - which is fair enough, www (whatever that is) doesn't exist, and neither does the bin directory. I've set up the 'skeleton' using the express command, and I've done minor modifications but they have all been according to this tutorial, and I haven't touched the placed in the json file where it states the starting directory (and neither has the person in the tutorial). Any help would be incredibly appreciated.
omar#omar-S550CM:~/Desktop/Projects/WebPages/nodetest2$ ls -a
. .. app.js data node_modules package.json public routes views
omar#omar-S550CM:~/Desktop/Projects/WebPages/nodetest2$ npm start
> nodetest2b#0.0.0 start /home/omar/Desktop/Projects/WebPages/nodetest2
> node ./bin/www
module.js:340
throw err;
^
Error: Cannot find module '/home/omar/Desktop/Projects/WebPages/nodetest2/bin/www'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
Note: npm and nodejs seem to be working fine otherwise.

Ahhh....after looking into it for quite a bit, it seemed like my whole nodejs environment might be a bit botched; and it certainly was. I uninstalled all nodejs elements and re-installed everything using nvm (via this guide: https://www.digitalocean.com/community/tutorials/how-to-install-express-a-node-js-framework-and-set-up-socket-io-on-a-vps), and it works perfectly now.

Related

npm start not working for react after changing partition directories in windows

i recently changed my hard drive partitions and merged them into one partition
now when i am trying to starting react from npm start its giving some error so i have uninstalled and reinstalled node js multiple times like 4 times but nothing worked ,
i have created a new react-redux project with npx create-react-app react-redux
here is my command line responses
PS D:\games&software\software\installed\web-development-folder\www\02\react\react-redux> npm start
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> react-redux#0.1.0 start
> react-scripts start
'software\software\installed\web-development-folder\www\02\react\react-redux\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'D:\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
PS D:\games&software\software\installed\web-development-folder\www\02\react\react-redux>
one strange thing i have noticed is it is checking for modules in 'D:\react-scripts\bin\react-scripts.js'
but my project directory is D:\games&software\software\installed\web-development-folder\www\02\react\react-redux i feel like this is the main culprit but not sure , after doing too much research i have came for help so please if anyone know what can i do to solve this help me please .
you can try npm i to reinstall all the node_modules that you use. One option could be that they weren't installed properly.
this is totally unexpected error that the & sign was interferring with the url parsing as soon as i have moved my project out of that directory it worked
you can see in the error it was starting the url from 'software\software\installed\web-development-folder\www\02\react\react-redux\node_modules.bin'
but the root folder name is games&software
thanks for other answers and i have posted this if someone come to this situation it might help

React MODULE_NOT_FOUND error even if it should be correct

recently I've been working with react. I had 4 days free and took a rest. Soon as I started again and tried to npm start it displayed error in terminal. Before that I cleared my desktop because it had a lot of folders and I moved that project in other folder. I thought that that might somehow cause the error and I've just tried with new npx create-react-app my-app. However this didn't fix error. It displays it on every single react project I have. I've been googling for 2 hours and tried everything although it didn't work. Can somebody please help.
Error:
The system cannot find the path specified.
node:internal/modules/cjs/loader:936
throw err;
Error: Cannot find module 'C:\Users\nijaz\Desktop\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Thank you for your time.
I found what was problem for me. Actually my folder structure was going like this:
Web Dev & Programming => Udemy ReacJS => -First React Big Project => senbonzakura-food
And this "&" in the "Web Dev & Progamming" was making the probelm.
Just Delete the node_modules directory, Delete the package-lock.json file and Run npm install, Run npm start.
try this:
rm -rf node_modules package-lock.json
Also: You Just need to make Sure that right address path for app.js (it should be app.js, main.js, start.js, server.js, or whatever you picked up) in out Package.json file.
{"npm": .js}
good luck 🤝

''adonis' is not recognized as an internal or external command' problem even though I installed the CLI globally

My Windows 10 PC forces me to install CLI and assign environment varriables (happens when I install ionic). This time, same trouble with Adonis. First, the problem is 'adonis' is not recognized as an internal or external command'
To solve this, I have installed Adonis locally in C:\Users\mq003\AppData\Local\node_modules. Which I receive is the only #Adonis directory and it doesn't come with a .cmd file so I can't use this. Therefore, I imported directly the cli from github with npm i -save #adonisjs/cli and copy the .cmd files in npm directory, while others will be put in node_modules (because my Path declare I put the cmd there).
As you can see, all ngrok, ionic, etc. commands belong here. They all work perfectly fine in every terminals.
When I try to type adonis commands, this time, it said.
PS D:\adonis project> adonis --help
internal/modules/cjs/loader.js:626
throw err;
^
Error: Cannot find module 'C:\Users\mq003\AppData\Roaming\#adonisjs\cli\index.js'
?[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)?[39m
?[90m at Function.Module._load (internal/modules/cjs/loader.js:527:27)?[39m
?[90m at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)?[39m
?[90m at internal/main/run_main_module.js:17:11?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
requireStack: []
}
I think it requires #adonisjs directory outside, not in node_modules. So I get that directory out (as you can see in the picture). However, the error still exists.
Editted: I found an issue posted on Github seems relevant to my problem. I will link here in case it helps.
Github

Cannot find module 'unicode/category/So'

When i am trying to run this command - yo mobileangularui, its showing this error. I have read many solutions on the internet but none of them removed this error. Can anyone help?
module.js:341
throw err;
^
Error: Cannot find module 'unicode/category/So'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at symbols (/usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:6:16)
at /usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:123:5
at Object.<anonymous> (/usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:130:2)
There is, sometimes, an issue with npm and executing post install script. Try this steps :
cd /path/to/your/project/node_modules/unicode
check emptiness category directory with ls command
execute this command npm test
If the test is ok, you can continue your work. If it doesn't work check this issue on GitHub.
Hope it help and sorry for my English.
If you are facing this issue and you are behind windows please follow below steps, I hope worked for you :
Remove the unicode module using npm, npm remove unicode
Download the file from
http://unicode.org/Public/UNIDATA/UnicodeData.txt and placed it into
C:\usr\share\unicode-data\ if your project is in C drive, or if you are in
linux /usr/share/unicode or /usr/share/unicode-data
Install unicode again
There is a pending PR which will resolve this - https://github.com/dodo/node-unicodetable/pull/22

Error: Cannot find module '.../webpack'

I'm just starting with node, and server stuff in general. I was following along with a well-reviewed youtube video and am at a loss here. I installed webpack and webpack-dev-server both globally and in my project folder. Now if I try to run webpack (typing nodejs webpack in the terminal) or webpack-dev-server, it just give me this error:
andrew#AndrewLaptop:~/Documents/mean-todo-app$ nodejs webpack
module.js:340
throw err;
^
Error: Cannot find module '/home/andrew/Documents/mean-todo-app/webpack'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Shoudln't it be looking in mean-todo-app/node_modules/webpack instead of mean-todo-app/webpack?
Again, new to all of this so I could be missing something stupid, but I did search to no avail.
Thanks
edit: guess I could have mentioned I'm on Ubuntu if that matters
try using
npm install webpack
and do this in the root directory of your app.
var webpack = require('webpack');
you can use './webpack' only if you have something.js in the same directory
if you require modules installed from third party source like npm use only require('webpack');
Directly use webpack on your terminal. You don't need to refer nodejs here. Refer this documentation for executing webpack via command line as well as npm scripts: http://survivejs.com/webpack/developing-with-webpack/getting-started/#adding-a-build-shortcut
I had this problem as well. Struggled a few hours trying to figure this out. I'm on windows 10, so hopefully this will help you...
First, you need to run 2 separate processes. In Windows Power Shell, you run: node server
THEN... in another WPS, you run: webpack-dev-server
From Chrome, type in: localhost://8080
You don't want to run "node webpack-dev-server" in the second shell. That kept throwing me off.

Resources