Node js instalation error - javascript

When i try installing node js it gives me this errors
C:\Users\Administrator>cd C:/xampp/htdocs/chat
C:\xampp\htdocs\chat>npm install
npm WARN package.json chat#4.5.0 No repository field.
npm WARN package.json chat#4.5.0 No README data
npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\ node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall getaddrinfo
npm ERR! enoent getaddrinfo ENOENT registry.npmjs.org:443
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\xampp\htdocs\chat\npm-debug.log
My question is how can i prevent those errors and install node js and socket io correctly.

I suggest you install from NVM
after that. just do nvm install
to check. node -v inside your terminal

Install NodeJS from their website, then execute npm init within your project folder.
Afther that you can install dependencies from NPM.
Just read, what's on their websites under "getting started"...

I did npm init and this is my .json file
"name": "chat",
"version": "4.5.0",
"description": "IO",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Dan Vasii",
"license": "ISC",
"dependencies":
{
"socket.io" : "*",
"express" : "*"
}
}

Download the Windows installer from https://nodejs.org/en/ .
Run the installer (the .msi file you downloaded in the previous step.)
Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).

Here is the solution for the above error.
Go to (nodejs) and Download NodeJs.
Install the NodeJs where you want in your PC
Now try to execute the command npm install
The error will be resolved. Any help needed please refer to this link

Related

npm init will not create package.json file

test directory is empty and running npm init doesn't create a package.json file.
error below says there's no such directory which is confusing as I'm in said directory when running npm init command.
PS C:\Users\Sayee\OneDrive\Documents\test> npm init
Press ^C at any time to quit.
package name: (test)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Users\Sayee\OneDrive\Documents\test\package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\Sayee\OneDrive\Documents\test\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Sayee\OneDrive\Documents\test\package.json'
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\Sayee\AppData\Local\npm-cache\_logs\2021-09-01T19_50_44_400Z-debug.log
Versions:
node v15.5.1
npm v7.4.2
edit:
different error if I manually create an empty package.json file in the directory. Package.json file is not open anywhere and I've tried running terminal as admin.
npm ERR! code EPERM
npm ERR! syscall write
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, write
npm ERR! [Error: EPERM: operation not permitted, write] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'write'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sayee\AppData\Local\npm-cache\_logs\2021-09-01T23_57_39_015Z-debug.log
I believe the issue has nothing to do with npm/node, and it might be due to the special filesystem ownership/permission of C:\Users\Sayee\OneDrive\Documents\.
Disabling Controlled folder access in windows under Ransomeware Protection fixed the issue.

NPM scripts permission denied on chronos (chromebook shell)

I recently installed node on my chromebook. I have git cloned a basic node repo that is trying to run things like webpack, babel-node, and concurrently through npm scripts.
However, running webpack (in the same directory) works just fine.
I have run "sudo chmod -R 777 my_app" and it did not help.
Here is the error message:
chronos#localhost ~/Downloads/MODULE $ npm start
> my-glitch-app#0.0.1 start /home/chronos/user/Downloads/MODULE
> concurrently "webpack -w -p" "babel-node server.js"
sh: concurrently: Permission denied
npm ERR! Linux 3.18.0-14875-g438cb8ab27c6
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-glitch-app#0.0.1 start: `concurrently "webpack -w -p" "babel-node server.js"`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the my-glitch-app#0.0.1 start script 'concurrently "webpack -w -p" "babel-node server.js"'.
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 my-glitch-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently "webpack -w -p" "babel-node server.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-glitch-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-glitch-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/chronos/user/Downloads/MODULE/npm-debug.log
following my comment above, sudo mount -o remount,exec /home/chronos/user seemed to work, but i have further anomalies in my case, so i'd be curious about peer experience

How to install socket.io and mysql on Node.js

I'm too newbie to Node.js.
I'm trying to setup a basic site (in order to learn), to make a call from Javascript in front end to Node.js and return the data of a mysql query.
I followed some tutorials in internet and I made this packages.json file
{
"name": "Stock",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-watch": "^0.6.1",
"grunt-execute": "^0.2.2",
"socket.io":"lastest"
}
}
Then on my Linux I run: npm install Which I understand it will install all dependencies listed on the packages.json. But I'm getting this error:
npm WARN package.json Stock#0.0.1 No description
npm WARN package.json Stock#0.0.1 No repository field.
npm WARN package.json Stock#0.0.1 No README data
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm ERR! Error: No compatible version found: socket.io#'lastest'
npm ERR! Valid install targets:
npm ERR! ["0.3.8","0.4.0","0.4.1","0.5.1","0.5.3","0.6.0","0.6.1","0.6.3","0.6.4","0.6.5","0.6.6","0.6.7","0.6.8","0.6.9","0.6.10","0.6.11","0.6.12","0.6.14","0.6.15","0.6.16","0.6.17","0.6.18","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.7.5","0.7.6","0.7.7","0.7.8","0.7.9","0.7.10","0.7.11","0.8.0","0.8.1","0.8.2","0.8.3","0.8.4","0.8.5","0.8.6","0.8.7","0.9.0","0.9.1","0.9.1-1","0.9.2","0.9.3","0.9.4","0.9.5","0.9.6","0.9.7","0.9.8","0.9.9","0.9.10","0.9.11","0.9.12","0.9.13","0.9.14","0.9.15","0.9.16","1.0.0-pre","1.0.0-pre2","1.0.0-pre3","1.0.0-pre4","1.0.0-pre5","0.9.17","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.1.0","1.2.0","1.2.1","1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3.7"]
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:719:10)
npm ERR! at /usr/share/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.19.0-31-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pablo/Documents/clients/stock/node
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pablo/Documents/clients/stock/node/npm-debug.log
npm ERR! not ok code 0
I guess latest version for socket.io, is not ok? how would it work?
Part of the code I get from Here
You have a typo in the socket.io version. "socket.io":"lastest" should be changed to "socket.io":"latest".
it's supposed to be "latest" not "lastest"

How to run this node app that I imported from github?

First off, I am a complete noob to web development involving servers. I've searched tirelessly and done everything within my knowledge. I am way too curious to figure out how to run this node js app. Is it possible for anyone to give me a step by step instructions on how to get it running?
https://github.com/android-fanatic/video-timeline-comment-tagging-demo
I have mongodb and nodejs installed but I get this Darwin Error when I run
npm start
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/JonDoe/Documents/web_apps/video-timeline-comment-ta`
Any help will be greatly appreciated.
Inside the package.json file, the start script is not specified, so npm start wont work. Change your package.json to the following
{
"name":"real-video-fake-tags",
"version":"0.0.4",
"private":true,
"scripts": {
"start": "node app.js"
},
"dependencies":{
"express":"2.5.10",
"jade":">= 0.2.0",
"mongoose" :">= 2.7.0",
"mailer":">=0.6.7"
}
}

Node.js- "npm install express" error:0906D06C :PEM routines : PEM_read_bio npm

I have installed node.js and it has npm installed along with it. In my windows command prompt,when i write "npm install express", it gives me the following error.How to resolve this?
C:\Users>npm -v
2.11.2
C:\Users>npm install express
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program
Files\nodejs \node_modules\npm\bin\npm-cli.js" "install"
"express"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! error:0906D06C:PEM routines:PEM_read_bio:no start line
npm ERR!
npm ERR! If you need help, you may report this error at: npm ERR!
https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\npm-debug.log
I also got same problem after setting registry problem got resolved.
cmd>> npm set registry registry.npmjs.org
cmd>> npm install
it worked for me.

Categories

Resources