Trying to start webpack dev server(Ubuntu) - javascript

Trying to start webpack dev server on Ubuntu.
Tried npm install --no-optional
thinkpad-x220:~/Documents/Projects/javascript/webpack-starter$ npm run dev
npm ERR! Linux 4.15.0-50-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! missing script: dev
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! /home/joeenter code here/Documents/Projects/javascript/webpack-starter/npm-debug.log
thinkpad-x220:~/Documents/Projects/javascript/webpack-starter$

Install webpack-dev-server
npm install webpack-dev-server --save-dev
and then include this in your package.json
"scripts": {
"dev": "webpack-dev-server --mode development --open"
}
start the server with npm run dev from your cli

Related

error when displaying in heroku nodejs Conflicting peer dependency:

When deploying in horoku begins to install dependencies of my project and when it reaches the point of frontend shows me this error
> NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-alert#7.0.3
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"18.2.0" from the root project
npm ERR! peer react#">=0.14.0" from #hypnosphi/create-react-context#0.3.1
npm ERR! node_modules/#hypnosphi/create-react-context
npm ERR! #hypnosphi/create-react-context#"^0.3.1" from react-popper#1.3.11
npm ERR! node_modules/react-popper
npm ERR! react-popper#"^1.3.7" from mdbreact#5.2.0
npm ERR! node_modules/mdbreact
npm ERR! mdbreact#"5.2.0" from the root project
npm ERR! 24 more (react-transition-group, #react-aria/ssr, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.1 || ^17" from react-alert#7.0.3
npm ERR! node_modules/react-alert
npm ERR! react-alert#"7.0.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"^16.8.1 || ^17" from react-alert#7.0.3
npm ERR! node_modules/react-alert
npm ERR! react-alert#"7.0.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.T8Wjo/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.T8Wjo/_logs/2022-11-19T04_57_30_865Z-debug-0.log
-----> Build failed
I don’t really know what and because it’s the error, but there are error alert lines that catch my eye. this is my package.json
"engines": {
"node": "16.x",
"npm": "8.15.0"
},
"scripts": {
"start": "node backend/server.js",
"dev": "SET NODE_ENV=DEVELOPMENT& nodemon backend/server.js",
"prod": "SET NODE_ENV=PRODUCTION& nodemon backend/server.js",
"seeder": "node backend/utils/seeder.js",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend"
},
someone has had this mistake or would know that it may be what you are doing wrong. thank you very much

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"

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.

Yeoman Javascript error involving 'mkdir'

I'm setting up a Meanjs instance with a Yeoman generator. When I do 'sudo yo meanjs' everything works fine until it looks like it is trying to make a directory and it fails, any ideas on what is going on here?
SOLINK_MODULE(target) Release/kerberos.node: Finished
> bson#0.2.5 install /Users/xxx/Documents/mean/node_modules/connect-
mongo/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
npm ERR! Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! { [Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/.npm/uglify-js/2.4.15',
npm ERR! parent: 'grunt-contrib-uglify' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/xxx/Documents/mean
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /Users/xxx/.npm/uglify-js/2.4.15
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! not ok code 0
That is a pretty common error.
Yeoman is running the following:
bower install & npm install
Bower install succeeded, however NPM install is failing because of user permissions. Just run:
sudo npm install
The ZenCoder's answer is spot on, but if you want to permanently fix this permissions error, you can follow the tutorial at: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Since you're on a Mac, you could actually avoid npm permissions errors altogether by just installing node instead via homebrew:
brew install node (this will install npm too)
Homebrew installs programs to a directory that doesn't require sudo for write, so you can npm install -g <whatever> freely without it.

Categories

Resources