When trying to npm install this exact package.json, npm hangs and becomes totally unreponsive.
{
"name": "My Project",
"description": "My Project",
"version": "1.0.0",
"private": true,
"main": "server.js",
"dependencies": {
"body-parser": "^1.15.2",
"compression": "^1.6.2",
"cors": "^2.8.0",
"loopback": "^2.31.0",
"loopback-boot": "^2.21.0",
"loopback-component-explorer": "^2.5.0",
"loopback-connector-mysql": "^2.3.0",
"loopback-connector-redis": "^0.0.3",
"loopback-datasource-juggler": "^2.50.0",
"loopback-ds-timestamp-mixin": "^3.4.0",
"mosca": "^2.1.0",
"mqtt": "^1.14.1",
"q": "^1.4.1",
"redis": "^2.6.2",
"serve-favicon": "^2.3.0",
"socket.io": "^1.4.8",
"socketio-auth": "0.0.5"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-docular": "^0.2.4",
"grunt-loopback-sdk-angular": "^1.2.0",
"jshint": "^2.9.3"
},
"scripts": {
"start": "node .",
"pretest": "jshint ."
}
}
I tested this on different clients, both using npm version 3.10.6 and node v6.5.0. I'm pretty sure it worked some days ago, but now, it just refuses to complete. I tried npm cache clean, tried lowering maxsockets down to 1, waiting for 20-30 minutes and tried to remove packages from packages.json, but finding the culprit it's a hit and miss. For example, "mosca" alone makes npm hang, but even when removed from package.json, it still won't finish.
The last message I see it's:
[ .....] - extract:socketio-auth: sill doParallel extract 852
and then just nothing. It doesn't give any error, even when setting logging level to silly. It just hangs forever. I really don't understand and I'm pretty sure it was working some day ago. Can someone help me? Does this package.json work for you?
I already checked this,this and this, but I think it's not related to them.
I't a known npm bug, still open... :-(
I'd rollback npm to 6.4 (which is #13782 bug free), till it's fixed...
Related
i'm new with node, i have to deploy my first application.
this is my package.json:
{
"name": "tbcw",
"description": "TheBestCollectors",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"truffle-compile": "truffle compile",
"truffle-serve": "truffle serve",
"truffle-test": "truffle test --network test"
},
"dependencies": {
"vue": "^2.4.4",
"vue-draggable-resizable": "^1.5.1",
"vuex": "^2.4.1",
"web3": "^1.2.11"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^6.0.0",
"babel-preset-env": "^1.7.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"ejs": "^2.5.7",
"ejs-compiled-loader": "^2.2.0",
"eslint": "^4.8.0",
"ethereumjs-testrpc": "^4.1.3",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.30.1",
"json-loader": "^0.5.7",
"node-sass": "^4.9.4",
"null-loader": "^0.1.1",
"sass-loader": "^5.0.1",
"truffle": "^3.4.11",
"truffle-contract": "^1.1.6",
"vue-loader": "^12.1.0",
"vue-template-compiler": "^2.4.4",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.9.1"
}
}
in local with dev mode everything works correctly.
Now I would like to publish my app on heroku.
after uploading the files with herokuCLI, when i run the app, I get an error page.
reading them via the command "heroku logs --tail"
based on different attempts i got different errors, like webpack not found, start script not found, cross-env not found...
how can i proceed?
Please let me know if you need more info.
thank you for all the replies
Looking at your package.json, it seems your are working on a client-side application. Such applications run in the client's browser, rather than in Node. Heroku is for running server-side applications, so it's probably not the right place to deploy your app.
Take a look at something like Vercel or Netlify instead. They provide tools to automatically build and deploy client-side applications to edge networks with only a few clicks.
Heroku, by default, doesn't install devDependencies. It seems your cross-env and webpack are listed as devDependencies. And you don't even have a start script.
I continue to have issues deploying to Heroku and I can't find out what is going wrong for the life of me. The Heroku error log tells me this after it successfully builds my react app:
-----> Caching build
- node_modules
-----> Pruning devDependencies
npm ERR! Cannot read property 'match' of undefined
Here is my package.json
{
"name": "test",
"version": "1.0.0",
"homepage": "./",
"description": "test",
"main": "server.js",
"node": "v12.13.1",
"npm": "6.13.7",
"scripts": {
"heroku": "node server.js",
"client-install": "npm install --prefix client",
"build": "cd client && react-scripts build",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
"author": "John Doe",
"license": "MIT",
"dependencies": {
"#material-ui/core": "^4.8.0",
"axios": "^0.19.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"classnames": "^2.2.6",
"concurrently": "^5.1.0",
"date-fns": "^2.8.1",
"debug": "^4.1.1",
"depcheck": "^0.9.1",
"eslint-plugin-flowtype": "^4.6.0",
"express": "^4.16.4",
"fibers": "^4.0.2",
"growl": "^1.10.5",
"heroku": "^7.35.1",
"history": "^4.10.1",
"is-empty": "^1.2.0",
"jquery": "^3.4.1",
"jsonwebtoken": "^8.3.0",
"jwt-decode": "^2.2.0",
"material-table": "^1.54.2",
"material-ui": "^0.20.2",
"minimatch": "^3.0.4",
"moment": "^2.23.0",
"mongodb": "^3.5.3",
"mongoose": "^5.8.9",
"mongoose-global": "^1.0.1",
"morgan": "^1.9.1",
"node-sass": "^4.13.0",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"plaid": "^4.6.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-ga": "^2.7.0",
"react-plaid-link-button": "0.0.4",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.3.0",
"react-slick": "^0.25.2",
"react-stripe-elements": "^6.0.1",
"react-vis": "^1.11.7",
"redux-thunk": "^2.3.0",
"sass": "^1.24.0",
"slick": "^1.12.2",
"slick-carousel": "^1.8.1",
"typescript": "^3.7.4",
"update-mongo": "0.0.4",
"validator": "^12.2.0",
"vis": "^4.21.0-EOL"
},
"devDependencies": {},
"engines": {
"node": "12.x"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
What is perhaps most frustrating, is that I was able to deploy successfully once the other day but I am not sure what changed. Going back through my git I can't see anything that would have made any difference.
Things I have tried:
removing package.json
adding "devDependencies": {} to my package.json (although I
deployed successfully without it)
updating node and adding the engines section to my package.json to
match.
running npm prune locally
ensuring that all packages are updated and referenced appropriately in package.json
Things that I suspect could be the issue:
Maybe somehow the current version of my app that is actively deployed on heroku is interfering with my new deployment? That being said i have tried scaling down dynos and deploying. Additionally the npm ERR! Cannot read property 'match' of undefined seems to indicate something else?
Just run into this after my deploys inexplicably started failing after a number of successful ones.
Stopping heroku from caching node_modules seemed to do the trick for me.
heroku config:set NODE_MODULES_CACHE=false
Then git push heroku master
I don't have package-lock.json committed after hearing Heroku doesn't get on well with lockfiles, but wondering if that's the problem.
Please rm -rf node_modules && npm i
also be sure to track package-lock.json file
And as long as you are there, is not related but may be a good idea to add a .nvmrc file
node -v >> .nvmrc
Let us know if it helped
In the scripts section in package.json, only keep the start key and remove others.
Your scripts in the package.json should be,
"scripts": {
"start": "node server.js"
},
Also before deployment, build the react app manually.
Heroku messed up with all these build scripts.
So I'm working on some projects within my work space and I notice that a lot of my dependencies are roughly 3 years old, including React itself. The thing I'm worried about is that if I run npm install or npm update that things might break and I could run into a plethora of issues. In my scenario I would like to know if it is better for me to do an npm install, npm update, or just leave it the way it is? (which I'm sure no one would recommend).
Here is our package.json file
{
"name": "my-app",
"version": "0.0.2",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "node src/entry",
"start-dev": "npm-run-all --parallel build babel-node",
"serve": "live-server public/",
"build-linux": "clear && webpack && clear && yarn build-server && clear && yarn start",
"build-windows": "cls && webpack && cls && yarn build-server && cls && yarn start",
"build-server": "babel src/server -d src",
"dev-server": "webpack-dev-server",
"babel-node": "nodemon --exec babel-node src/server.js"
},
"dependencies": {
"aws-sdk": "^2.358.0",
"axios": "^0.19.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "7.1.1",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "6.24.1",
"babel-preset-stage-0": "^6.24.1",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.2",
"core-js": "^2.5.3",
"css-loader": "0.28.4",
"express": "latest",
"file-loader": "^1.1.5",
"fs": "0.0.1-security",
"google-maps-react": "^1.1.4",
"html2canvas": "^1.0.0-rc.3",
"image-webpack-loader": "^4.6.0",
"immutability-helper": "^2.4.0",
"jquery": "^3.4.1",
"jsonwebtoken": "^8.1.0",
"jspdf": "^1.5.3",
"lodash": "^4.17.14",
"moment": "^2.22.2",
"node-sass": "^4.11.0",
"nodemailer": "^4.7.0",
"normalize.css": "7.0.0",
"npm": "^6.10.1",
"promise-mysql": "^3.1.0",
"prop-types": "^15.6.0",
"react": "^16.0.0",
"react-csv": "^1.0.14",
"react-dom": "^16.0.0",
"react-router-dom": "4.2.2",
"react-scripts": "^2.1.3",
"sass-loader": "6.0.6",
"socket.io": "^2.0.3",
"style-loader": "0.18.2",
"table2csv": "^1.1.1",
"twilio": "^3.24.0",
"validator": "8.0.0",
"webpack": "^3.12.0",
"webpack-dev-middleware": "^3.5.0",
"webpack-dev-server": "^3.1.14"
},
"devDependencies": {
"concurrently": "^3.5.0",
"npm-run-all": "^4.1.1"
}
}
I already tried updating my react and react-dom versions to the latest, but I started getting warnings about componentWillMount and componentWillReceiveProps being outdated. I tried updating react-router-dom to get rid of some of those warnings, considering they were pointing to things like Link, Route, Switch, but that did not suppress them.
If anyone knows what the best way for me to go about this would be, and what the effects of npm install vs npm update would do to my system that would be great. I know what each of them is capable of doing, but I'm just trying to be cautious and want to know which one would be better in my scenario. Thanks.
When you run npm install on a project, npm installs latest versions satisfying the semantic versioning ranges defined in your package.json. After initial install, re-running npm install does not update existing packages since npm already finds satisfying versions installed on the file system.
When you run npm update it freshen already installed packages. When you run npm update, npm checks if there exist newer versions in the repository that satisfy specified semantic versioning ranges and installs them.
I would say "bite the bullet" and update them to latest. It will be a tedious task but if you are looking to maintain this for longer run, it is your best bet.
Updating stuff can break things or some dependencies will be deprecated after an update. I would not update anything unless it is necessary.
I'm new to using gulp and browserify. I'm trying to follow a tutorial online which uses browserify and gulp.
Following is my package.json
{
"name": "progressive",
"version": "1.0.0",
"description": "Practcing a Progressive Web App",
"scripts": {
"start": "node ./index.js"
},
"author": "Indu Pillai",
"devDependencies": {
"browserify": "^13.1.0",
"gulp": "^3.8.8",
"gulp-browserify": "^0.5.1",
"gulp-clean-css": "^2.0.13",
"gulp-concat-css": "^2.3.0",
"gulp-if": "^2.0.1",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"gulp-util": "^2.2.20",
"gulp-webserver": "^0.8.8",
"jquery": "^3.1.1",
"sw-precache": "^4.2.1"
},
"dependencies": {
"handlebars": "^4.0.5"
}
}
When I run npm install, it gives me the following error:
npm WARN browserify-shim#2.0.10 requires a peer of browserify#>= 2.3.0 < 4 but none was installed.
I don't know how to solve this problem, I'm not good at npm stuff either. I didn't ask for browserify-shim in my package.json, but may be some of the packages I asked depends on it.
Thank You!
I have the same problem
and I solve it with the following:
If you use the windows you should
Download the :(Windows Binary.Zip)
Then choose the correct architecture to your computer (32 or 64),
make it active
Open Command Prompt as Administrator
Execute this on the command line: npm install -g #angular/cli
noob question regarding Node and npm: I have a package.json file with a list of dependancies that I want to install with npm install. When I run the command, nothing happens, I don't even receive an error, nothing at all :(
But if I try to install a single package from the list, it works perfectly...
I haven't created the package.json myself, so I am not sure what the "proxyURL" thing does...
{
"name": "dss",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "*urlofmyrepo*"
},
"dependencies": {
"bower": "^1.7.7",
"cssmin": "^0.4.3",
"gulp": "^3.9.0",
"gulp-batch": "^1.0.5",
"gulp-concat": "^2.6.0",
"gulp-if": "^2.0.0",
"gulp-jshint": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-strip-debug": "^1.1.0",
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
"jshint": "^2.9.1",
"lodash": "^4.2.1",
"minimatch": "^3.0.0",
"sass": "^0.5.0",
"uglifyjs": "^2.4.10",
"underscore": "^1.8.3",
"yuglify": "^0.1.4"
},
"private": true,
"APIMethod": "stub",
"proxyURL": "http://localhost:8000",
"devDependencies": {}
}
Any clue?
Thank you
Rename/remove your package.json file.
Create a new package file by running:
npm init
Option A: Copy the dependencies you need into the newly created package.json.
Option B: Install the packages and use --save to add the packages to the package.json file.
Run npm install to install the dependencies.
just ran into this.
in my case the answer was environment variable NODE_ENV was set to 'production'
I haven't looked it up but when I changed it to something else, it started working.
I was testing this environment variable for something else and didn't realize it had this effect also.
For me it was a bad version value. Changing from 3.0 to 3.0.0 results in proper installation. 3.0 generates a warning, but fails to do the installation (ie it should be an error).