For any scripts that are set up in my package.json file for modules installed locally, npm says it cannot find the command.
Below is my package.json. I have already run an ‘npm install` without any issues installing the packages.
{
"name": "app",
"private": true,
"dependencies": {
"#babel/core": "^7.8.6",
"#babel/preset-env": "^7.8.6",
"#babel/preset-react": "^7.8.3",
"babel-loader": "^8.0.6",
"bootstrap": "^4.4.1",
"jquery": "^1.9.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-owl-carousel": "^2.3.1",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-slick": "^0.25.2",
"reactstrap": "^8.4.1",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"slick-carousel": "^1.8.1",
"webpack-cli": "^3.3.11"
},
"scripts": {
"postinstall": "webpack",
"start": "webpack --watch --mode=development"
},
"engines": {
"node": "10.13.0",
"npm": "6.4.1"
},
"devDependencies": {
"css-loader": "^3.4.2",
"style-loader": "^1.1.3",
"webpack": "^4.42.0"
}
}
When I try to run npm start from the root file, I get these errors:
sh: webpack: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! app# start: `webpack --watch --mode=development`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the app# start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I have this same problem across multiple projects. If I install globally it will work, but from what I understand with webpack, that should not be necessary and is discouraged: https://webpack.js.org/guides/installation/#global-installation.
Any ideas what the trouble may be here? Thanks!
The issue was the directory my app was located in had a / in the directory name (e.g. a/b > app > node_modules). The / is interpreted as a : and npm doesn't like that.
Related
For a fresh installation, I have removed the node_modules folder using the command rm -rf node_modules/.Then from the terminal I have run npm install in Ubuntu, but now i am getting below error, could someone please advise on what steps should I follow to fix this issue ?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #badeball/cypress-cucumber-preprocessor#11.4.0
npm ERR! Found: esbuild#0.15.10
npm ERR! node_modules/esbuild
npm ERR! dev esbuild#"^0.15.10" from the root project
npm ERR! peer esbuild#"*" from #bahmutov/cypress-esbuild-preprocessor#2.1.5
npm ERR! node_modules/#bahmutov/cypress-esbuild-preprocessor
npm ERR! dev #bahmutov/cypress-esbuild-preprocessor#"^2.1.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional esbuild#"^0.14.23" from #badeball/cypress-cucumber-preprocessor#11.4.0
npm ERR! node_modules/#badeball/cypress-cucumber-preprocessor
npm ERR! #badeball/cypress-cucumber-preprocessor#"^11.4.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: esbuild#0.14.54
npm ERR! node_modules/esbuild
npm ERR! peerOptional esbuild#"^0.14.23" from #badeball/cypress-cucumber-preprocessor#11.4.0
npm ERR! node_modules/#badeball/cypress-cucumber-preprocessor
npm ERR! #badeball/cypress-cucumber-preprocessor#"^11.4.0" 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 /home/den/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/den/.npm/_logs/2022-10-15T03_40_29_742Z-debug-0.log
// package.json
{
"name": "booktest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://someurl.com"
},
"author": "BookTest",
"license": "UNLICENSED",
"private": true,
"scripts": {
"remove-files": "node removeFiles.js",
"cucumber-report": "node createreport.js",
"cypress:open": "cypress open",
"cy:simpro-run": "cypress run && npm run cucumber-report",
"cy:rest-api": "cypress run --headless --spec tests/cypress/integration/restapi/**/*.spec.js"
},
"devDependencies": {
"#babel/core": "^7.13.8",
"#babel/polyfill": "^7.12.1",
"#babel/preset-env": "^7.13.9",
"#bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
"cheerio": "^1.0.0-rc.5",
"cucumber-html-reporter": "^5.3.0",
"cypress": "^10.10.0",
"cypress-dotenv": "^1.2.2",
"cypress-file-upload": "^4.1.1",
"cypress-localstorage-commands": "^1.4.1",
"cypress-wait-until": "^1.7.1",
"esbuild": "^0.15.10",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.22.0",
"fs-extra": "^8.1.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-babel": "^8.0.0",
"gulp-concat": "^2.6.1",
"gulp-debug": "^4.0.0",
"gulp-eslint": "^6.0.0",
"gulp-filter": "^6.0.0",
"gulp-fs-cache": "^0.1.0",
"gulp-iconfont": "^10.0.3",
"gulp-if": "^3.0.0",
"gulp-livereload": "^4.0.2",
"gulp-order": "^1.2.0",
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-terser": "^1.4.1",
"gulp-wait": "0.0.2",
"lazypipe": "^1.0.2",
"merge-stream": "^2.0.0",
"node-sass": "^4.14.1"
},
"browserslist": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 Edge versions",
"IE 11",
"last 2 ChromeAndroid versions",
"last 2 iOS versions",
"last 2 Samsung versions",
"last 2 FirefoxAndroid versions"
],
"dependencies": {
"#badeball/cypress-cucumber-preprocessor": "^11.4.0",
"#cypress/webpack-preprocessor": "^5.14.0",
"auth0-js": "^9.14.3",
"dotenv": "^8.2.0",
"idb": "^6.0.0",
"moment": "^2.29.1",
"papaparse": "^5.3.0",
"path": "^0.12.7",
"pdf-parse": "^1.1.1",
"pdfjs-dist": "^2.6.347"
}
}
The problem looks like a mis-match of versions, although I couldn't reproduce the same error message.
If you download the #badeball/cypress-cucumber-preprocessor repository file, unzip it and copy the example folder that most closely matches your current setup - looks like /esbuild-cjs is the closest.
If you use that folder as the project root (rename it whatever you want) and npm install to set up node-modules, then look in the node-module folder you will see these versions have been installed.
"cypress": "10.10.0",
"#badeball/cypress-cucumber-preprocessor": "#13.0.2",
"#bahmutov/cypress-esbuild-preprocessor": "#2.1.5"
"esbuild": '0.14.54',
which is fairly close to the recommendation in the error message.
The package.json just has
{
"devDependencies": {
"#badeball/cypress-cucumber-preprocessor": "latest",
"#bahmutov/cypress-esbuild-preprocessor": "latest",
"cypress": "latest"
}
}
If you want you can change latest to the specific versions, and add the other packages you need,
but don't add the entry for esbuild because it's correct version is already being installed by #badeball/cypress-cucumber-preprocessor.
Any additions you make to dependencies or devDependencies, you will need to run npm install to update node-modules.
I'm attempting to deploy a web3 application to heroku, but while building the npm dependencies, I get the following error:
remote: sh: 1: node-gyp-build: not found
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! syscall spawn
remote: npm ERR! file sh
remote: npm ERR! errno ENOENT
remote: npm ERR! bufferutil#4.0.3 install: `node-gyp-build`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the bufferutil#4.0.3 install script.
I believe this is because of the web3#1.3.6 dependency I am adding. If I leave this out of the npm dependencies in my package.json file, the deploy works successfully.
If I ssh into a console, I'm able to run npm install -g web3#1.3.6 and that is also successful. I've also tried adding node-gyp, node-gyp-build, and bufferutil as explicit dependencies in the package.json file. I'm using
node 14.17.0
npm 6.14.13
python 3.9.5
Below is my full package.json file
{
"engines": {
"node": "14.17.0",
"npm": "6.14.13"
},
"repository": {},
"description": " ",
"license": "MIT",
"scripts": {
"deploy": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"dependencies": {
"postcss": "8.1.0",
"#popperjs/core": "^2.9.2",
"bootstrap": "^5.0.1",
"jquery": "^3.6.0",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view",
"topbar": "^0.1.4",
"#babel/core": "^7.0.0",
"babel-polyfill": "^6.26.0",
"#babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.0",
"css-loader": "^5.2.6",
"sass-loader": "^10.0.0",
"node-sass": "^6.0.0",
"cropperjs": "1.5.12",
"eth-sig-util": "^1.4.2",
"jquery-cropper": "1.0.1",
"copy-webpack-plugin": "^5.1.1",
"hard-source-webpack-plugin": "^0.13.1",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"terser-webpack-plugin": "^2.3.2",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.2",
"web3": "1.3.6"
},
"devDependencies": {},
}
I am trying to deploy a Django Application on Heroku with the node and npm installations, however, while deploying the application I get the following error on the Heroku console:
npm ERR! node v11.13.0
npm ERR! npm v2.15.12
npm ERR! path /tmp/build_number/node_modules/.bin/grunt
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall unlink
npm ERR! enoent ENOENT: no such file or directory, unlink '/tmp/build_number/node_modules/.bin/grunt'
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! /tmp/build_number/npm-debug.log
-----> Build failed
I am trying to build charts using Vue.js components that uses buildpacks. I would like to know how to install the npm on Heroku. Any help will be greatly appreciated.
I have the following configuration for the website:
Django version: 2.1.7
Node Version: 11.3.0
Python Version: 3.7.3
My package.json file looks as follows:
{
"name": "django",
"private": true,
"scripts": {
"start": "node app",
"poststart": "npm prune --production",
"pretest": "eslint django/ js_tests/admin/ js_tests/gis/",
"test": "grunt test --verbose"
},
"engines": {
"node": "11.13.0",
"npm": ">=1.3.0 <3.0.0",
"build": "bower install && grunt build",
"start": "nf start"
},
"devDependencies": {
"#babel/core": "^7.4.3",
"#babel/plugin-transform-runtime": "^7.4.3",
"#babel/preset-env": "^7.4.3",
"#babel/runtime": "^7.4.3",
"axios": "^0.18.0",
"babel-loader": "^8.0.5",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"bootstrap-sass": "^3.4.1",
"css-loader": "^2.1.1",
"eslint": "^5.16.0",
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-contrib-qunit": "^1.2.0",
"jquery": "^3.3.1",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"vue": "^2.6.10",
"vue-hot-reload-api": "^2.3.3",
"vue-loader": "^15.7.0",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.29.6",
"webpack-bundle-tracker": "^0.4.2-beta",
"webpack-cli": "^3.3.0"
},
"description": "FitGirl Inc",
"version": "1.0.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/uno-isqa-8950/fitgirl-inc.git"
},
"author": "hghanta",
"license": "ISC",
"bugs": {
"url": "https://github.com/uno-isqa-8950/fitgirl-inc/issues"
},
"homepage": "https://github.com/uno-isqa-8950/fitgirl-inc#readme",
"dependencies": {
"chart.js": "^2.8.0",
"vue-chartjs": "^3.4.2",
"vue-cli": "^2.9.6"
},
"keywords": [
"djano"
]
}
My ProcFile is as follows:
web: node node_modules/gulp/bin/gulp build, gunicorn empoweru.wsgi:application --log-file -
'''
Heroku by default has it's Node modules cache enabled. So when you try to make changes to your package.json Heroku does not recognize your changes to the devDependencies. Follow these two steps and you should be able to deploy it:
Remove grunt-cli from your devDependencies
Run this command to disable cache
heroku config:set NODE_MODULES_CACHE=false
Deploy your code
I am getting the below error while trying to run npm start without updating the node version nor the npm version.
ERROR
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Work\node-v6.10.3-win-x64\node-v6.10.3-win-x64\node.exe" "
C:\Work\node-v6.10.3-win-x64\node-v6.10.3-win-x64\node_modules\npm\bin\np
m-cli.js" "start"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ucps-online-client#1.0.0 start: ng serve --proxy-config proxy.conf.jso
n
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ucps-online-client#1.0.0 start script 'ng serve --proxy-c
onfig proxy.conf.json'.
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 ucps-online-client pa
ckage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng serve --proxy-config proxy.conf.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ucps-online-client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ucps-online-client
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Work\workspace_Nov9_commit\ucps-online-parent\ucps-online-client
\npm-debug.log
Package.json
{
"name": "ucps-online-client",
"version": "1.0.0",
"private": true,
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"lint": "ng lint"
},
"dependencies": {
"#angular/animations": "^4.0.1",
"#angular/common": "^4.0.0",
"#angular/compiler": "^4.0.0",
"#angular/core": "^4.0.0",
"#angular/forms": "^4.0.0",
"#angular/http": "^4.0.0",
"#angular/platform-browser": "^4.0.0",
"#angular/platform-browser-dynamic": "^4.0.0",
"#angular/router": "^4.0.0",
"bootstrap": "3.3.7",
"core-js": "^2.4.1",
"font-awesome": "4.6.3",
"jquery": "2.2.3",
"latest-version": "^3.1.0",
"moment": "2.17.1",
"ng2-bootstrap": "1.6.3",
"ng2-datepicker": "^1.8.3",
"ng2-datetime-picker": "^0.12.5",
"ng2-pagination": "^2.0.2",
"primeng": "4.1.0",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.8.5"
},
"devDependencies": {
"#angular/compiler-cli": "^4.0.0",
"#types/node": "^7.0.12",
"#angular/cli": "^1.0.0",
"codelyzer": "^2.1.1",
"ts-node": "^3.0.2",
"tslint": "^5.0.0",
"typescript": "^2.2.2"
},
"engines": {
"node": ">= 6.9.1",
"npm": ">= 3"
}
}
I have no idea why I get an error for mongoskin. I used this module before but I got rid of it. I removed the node_modules directory then did a fresh npm install, fine everything installs. Then I tried to add a new module minimist as seen below:
C:\www\instantynode\src>npm install minimist --save
npm WARN package.json instanty#0.1.1 No description
npm WARN package.json instanty#0.1.1 No repository field.
npm WARN package.json instanty#0.1.1 No README data
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "minimist" "--save"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package mongodb#2.1.4 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer mongoskin#1.4.13 wants mongodb#~1.4
npm ERR! Please include the following file with any support request:
npm ERR! C:\www\instantynode\src\npm-debug.log
package.json:
{
"name": "app",
"version": "0.1.1",
"description": "",
"dependencies": {
"bunyan": "1.5.1",
"co": "4.6.0",
"cookie-parser": "^1.4.0",
"forever": "^0.15.1",
"fs": "0.0.2",
"geoip-lite": "^1.1.6",
"handlebars": "^4.0.5",
"jsonwebtoken": "^5.4.1",
"jwt-simple": "^0.4.0",
"koa": "^1.1.2",
"koa-better-ratelimit": "^2.1.2",
"koa-bodyparser": "^2.0.1",
"koa-conditional-get": "^1.0.3",
"koa-generic-session": "^1.10.0",
"koa-handlebars": "^0.5.7",
"koa-mount": "^1.3.0",
"koa-multer": "1.0.0",
"koa-passport": "^2.0.1",
"koa-redis": "^1.0.1",
"koa-router": "^5.3.0",
"koa-static": "^1.5.2",
"lodash": "^3.10.1",
"mongodb": "2.1.4",
"nodemailer": "2.1.0",
"nodemon": "^1.8.1",
"passport": "^0.3.2",
"passport-http-bearer": "^1.0.1",
"passport-local": "^1.0.0",
"socket.io": "^1.3.7",
"socketio-jwt": "^4.3.3"
},
"devDependencies": {
"assert": "1.3.0",
"del": "2.1.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "3.1.0",
"gulp-concat": "2.6.0",
"gulp-concat-css": "2.2.0",
"gulp-imagemin": "2.4.0",
"gulp-less": "3.0.5",
"gulp-minify-css": "1.2.2",
"gulp-notify": "2.2.0",
"gulp-uglify": "1.5.1",
"imagemin-pngquant": "4.2.0",
"jsdoc": "3.4.0",
"node-inspector": "0.12.5",
"run-sequence": "1.1.5"
},
"main": "app.js",
"scripts": {
"startfn": "forever start -c \"nodemon --harmony\" app.js --exitcrash",
"startf": "forever start -c \"node --harmony\" app.js",
"start": "node --harmony app.js"
},
"author": "",
"license": "ISC"
}
npm install minimist --save does not work as you can see, does not install or add itself to the package.json file. And it is still mentioning mongoskin?
I have a feeling that the NPM in Windows is buggy?
i think that mongoskin only work with mongodb driver older than 1.4. You might have installed mongoskin in global mode, try to remove it.
You are trying to install minimist, which has its own package.json with its own dependencies. In these it says that it wants mongoskin to be installed, which has a dependency on mongodb itself, but in another version than you have it (you have 2.1.4 but as the error says, it needs ~1.4).
So, because you provided the --save parameter, you want npm to respect these dependencies and do not install mongodb in the desired version on top of it.
Ok I've found the issue. The NPM in Windows is way more sensitive than the one in Linux. In Linux I can manually remove the line from the package.json file and just remove the node_modules directory. However in Windows it appears to be cached by NPM, so I had to manually use the npm remove mongoskin --save command.
When I did this so that the package.json looked like it should I was able to install minimist via npm install minimist --save without issues!
I'm not surprised Windows... Not surprised...
In your package.json, try to change this:
"mongodb": "2.1.4",
to this:
"mongodb": "1.4.*",