How fix it: 42 vulnerabilities (3 low, 15 moderate, 24 high)? - node.js

Here are my settings:
My Environment and Versions:
nodeJS: v14.18.1
npm: 8.1.1
expo-cli: 4.12.10
OS: MacOS Big Sur 11.6
My package.json:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"axios": "^0.24.0",
"expo": "^1.0.0",
"expo-status-bar": "~1.1.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "^0.66.1",
"react-native-camera": "^4.2.1",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
After npm install After this command I get a message like this:
error message after npm install
42 vulnerabilities (3 low, 15 moderate, 24 high)
After this message I tried: npm update --legacy-peer-deps
And now i get: 31 vulnerabilities (8 moderate, 23 high)
When i try use npm audit fix i get this: unable to resolve dependency tree
Here is the full text of the log:
# npm resolution error report
2021-10-26T12:26:46.860Z
While resolving: rcapp#undefined
Found: react#17.0.1
node_modules/react
react#"17.0.1" from the root project
Could not resolve dependency:
peer react#"17.0.2" from react-native#0.66.1
node_modules/react-native
react-native#"^0.66.1" from the root project
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.
Raw JSON explanation object:
{
"code": "ERESOLVE",
"current": {
"name": "react",
"version": "17.0.1",
"whileInstalling": {
"name": "rcapp",
"path": "/Users/maksimpaun/Desktop/sdaibox-terra/reclub/rcapp"
},
"location": "node_modules/react",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "react",
"spec": "17.0.1",
"from": {
"location": "/Users/maksimpaun/Desktop/sdaibox-terra/reclub/rcapp"
}
}
]
},
"currentEdge": {
"type": "prod",
"name": "react",
"spec": "17.0.1",
"from": {
"location": "/Users/maksimpaun/Desktop/sdaibox-terra/reclub/rcapp"
}
},
"edge": {
"type": "peer",
"name": "react",
"spec": "17.0.2",
"error": "INVALID",
"from": {
"name": "react-native",
"version": "0.66.1",
"whileInstalling": {
"name": "rcapp",
"path": "/Users/maksimpaun/Desktop/sdaibox-terra/reclub/rcapp"
},
"location": "node_modules/react-native",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "react-native",
"spec": "^0.66.1",
"from": {
"location": "/Users/maksimpaun/Desktop/sdaibox-terra/reclub/rcapp"
}
}
]
}
},
"strictPeerDeps": false,
"force": false
}
So, after this i try use: npm audit fix --legacy-peer-deps, but it doesn't help.
The project itself seems to run without problems, but such a large number of errors worries me.
Please tell me how I can identify them and fix them.
Thank you in advance for your help!

STEP 1
Delete the node_modules folder.
STEP 2
Update the packages to latest version. Change you package.json like this:
"dependencies": {
"axios": "^0.24.0",
"expo": "^43.0.1 ",
"expo-status-bar": "^1.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-native": "^0.66.1",
"react-native-camera": "^4.2.1",
"react-native-web": "^0.17.5",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"#babel/core": "^7.15.8"
},
STEP 3
Do npm install
STEP 4
Check if vulnerabilities are fixed.

Related

npm install <package> working and npm install not working

If I download the source code and run:
npm install
It crashes during installation ( I think it runs out of memory), however if I directly:
npm install bigchaindb-driver
(version 0.3.0)
Then is fine...
Log error:
npm http request GET https://registry.npmjs.org/is-fullwidth-code-point
npm http 304 https://registry.npmjs.org/is-fullwidth-code-point
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/lcid
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/mem
npm http 304 https://registry.npmjs.org/lcid
npm http 304 https://registry.npmjs.org/mem
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/invert-kv
npm http 304 https://registry.npmjs.org/invert-kv
npm info lifecycle bigchaindb-driver#0.3.0~preinstall: bigchaindb-driver#0.3.0
Killed ....] - extract:moo-server: sill gunzTarPerm extractEntry lolex.js
Btw if I install them one by one, it does not run out of memory but it is not able to install the following dependencies:
bigchaindb-driver#0.3.0 /
+-- UNMET PEER DEPENDENCY babel-eslint#8.0.0
+-- UNMET PEER DEPENDENCY eslint#4.1.1
`-- UNMET PEER DEPENDENCY webpack#3.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN babel-loader#7.0.0 requires a peer of webpack#2 but none was installed.
npm WARN eslint-config-airbnb-base#11.3.2 requires a peer of eslint#^3.19.0 || ^4.5.0 but none was installed.
npm WARN eslint-config-airbnb-base#11.3.2 requires a peer of eslint-plugin-import#^2.7.0 but none was installed.
npm WARN eslint-config-ascribe#3.0.4 requires a peer of babel-eslint#^7.1.1 but none was installed.
npm WARN eslint-plugin-import#2.2.0 requires a peer of eslint#2.x - 3.x but none was installed.
Why with one method is working and with the other no? what is the difference between the commands and how could I fix it?
Edit:
Ubuntu 16.04 64bit
npm 3.10.10
nodejs 6.11.4
bigchaindb-driver 0.3.0
Package.json:
{
"_args": [
[
{
"raw": "bigchaindb-driver",
"scope": null,
"escapedName": "bigchaindb-driver",
"name": "bigchaindb-driver",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"/test_bcdb"
]
],
"_from": "bigchaindb-driver#latest",
"_id": "bigchaindb-driver#0.3.0",
"_inCache": true,
"_location": "/bigchaindb-driver",
"_nodeVersion": "7.8.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/bigchaindb-driver-0.3.0.tgz_1499272002696_0.40300624282099307"
},
"_npmUser": {
"name": "vrde",
"email": "agranzot#gmail.com"
},
"_npmVersion": "5.0.4",
"_phantomChildren": {},
"_requested": {
"raw": "bigchaindb-driver",
"scope": null,
"escapedName": "bigchaindb-driver",
"name": "bigchaindb-driver",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/bigchaindb-driver/-/bigchaindb-driver-0.3.0.tgz",
"_shasum": "2c71ab0e49dd7cbd6f760639767d4148e911e92b",
"_shrinkwrap": null,
"_spec": "bigchaindb-driver",
"_where": "/test_bcdb",
"author": {
"name": "BigchainDB"
},
"ava": {
"files": [
"test/*.js"
],
"source": [
"**/*.{js,jsx}",
"!node_modules/**/*",
"!dist/**/*"
],
"failFast": true,
"failWithoutAssertions": false,
"tap": true,
"powerAssert": false,
"require": [
"babel-register"
],
"babel": "inherit"
},
"browser": "./dist/browser/bigchaindb-driver.cjs2.min.js",
"bugs": {
"url": "https://github.com/bigchaindb/js-bigchaindb-driver/issues"
},
"dependencies": {
"browser-resolve": "^1.11.2",
"bs58": "^4.0.0",
"buffer": "^5.0.2",
"clone": "^2.1.0",
"core-js": "^2.4.1",
"decamelize": "^1.2.0",
"es6-promise": "^4.0.5",
"fetch-ponyfill": "^4.0.0",
"five-bells-condition": "^5.0.1",
"isomorphic-fetch": "^2.2.1",
"js-sha3": "^0.6.1",
"js-utility-belt": "^1.5.0",
"json-stable-stringify": "^1.0.1",
"query-string": "^4.3.4",
"sprintf-js": "^1.0.3",
"tweetnacl": "^1.0.0",
"yarn": "^0.27.5"
},
"description": "Node.js driver for BigchainDB",
"devDependencies": {
"ava": "^0.20.0",
"babel-cli": "^6.22.2",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015-no-commonjs": "0.0.2",
"babel-preset-latest": "^6.22.0",
"babel-runtime": "^6.22.0",
"cross-env": "^5.0.1",
"eslint": "^4.1.1",
"eslint-config-ascribe": "^3.0.4",
"eslint-plugin-import": "^2.2.0",
"husky": "^0.14.0",
"lint-staged": "^4.0.0",
"nyc": "^11.0.2",
"release-it": "^2.7.3",
"rimraf": "^2.5.4",
"sinon": "^2.3.4",
"webpack": "^3.0.0"
},
"directories": {},
"dist": {
"integrity": "sha512-zpy0xZ73PXfH2k5sNTukgd7drPvGrHcPdA520glBGRiv3pfENo3TBFtNfGBymGRVRfQ519GFR+vzCbmftCs24w==",
"shasum": "2c71ab0e49dd7cbd6f760639767d4148e911e92b",
"tarball": "https://registry.npmjs.org/bigchaindb-driver/-/bigchaindb-driver-0.3.0.tgz"
},
"gitHead": "a9fb0730727a7aca3d0f61662ad043dfca3b284f",
"homepage": "https://www.bigchaindb.com/",
"keywords": [
"bigchaindb",
"driver",
"blockchain",
"decentralized",
"dapp"
],
"license": "Apache-2.0",
"lint-staged": {
"*.js": [
"eslint"
]
},
"main": "./dist/node/index.js",
"maintainers": [
{
"name": "vrde",
"email": "agranzot#gmail.com"
}
],
"name": "bigchaindb-driver",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/bigchaindb/js-bigchaindb-driver.git"
},
"scripts": {
"build": "npm run clean && npm run build:cjs && npm run build:dist",
"build:bundle": "webpack",
"build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node",
"build:dist": "cross-env NODE_ENV=production webpack -p",
"clean": "rimraf dist/bundle dist/node",
"lint": "eslint ./",
"precommit": "lint-staged",
"prepublishOnly": "npm update && npm run build",
"release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
"release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive",
"release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive",
"report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
"test": "npm run lint && nyc ava test/ && npm run thanks && npm run report-coverage",
"thanks": "cowsay Hi, thanks for your interest in BigchainDB. We appreciate your contribution!"
},
"version": "0.3.0"
}
The package.json is the original from js-bigchaindb-driver
Finally, I found the source of the error:
npm install
Installs the package with the development dependencies and it is needed to add the flag --production not to get them.
So the equivalent will be:
npm install <package>
and
npm install --production
(assuming there is a package.json in the directory)

Git Bash and webpack

Hello guys I'm trying to learn Webpack I've been following some tutorials and I've run into some problems. I've installed webpack locally in folder I am working in with npm install webpack --save-dev. I made two JS scripts and I wanted to bundle them and I've tried following command webpack script-1.js /.bundle.js in WindowsPowerShell (I'm using Windows 7). Now this made the following error
webpack is not recognized as an internal or external command operable program or batch file
So then I installed webpack globally, and when I used the same command in PowerShell (I have opened it as an admin), it made bundle.js file but not in the directory I was working in, but in C:
Now after this failure I've decided to try using git bash. First I've tried this command webpack script-1.js /.bundle.js and got the following error
bash: webpack: command not found
Finally after some trying I was able to make it work using this command in git bash node_modules/.bin/webpack ./script-1.js bundle.js
Is there a way to fix this, so I can just type webpack instead of whole path ? Also is there a way to fix path in PowerShell ?
This is mine package.json
{
"name": "webpack-playlist",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/iamshaunjp/webpack-playlist.git"
},
"author": "me",
"license": "MIT",
"bugs": {
"url": "https://github.com/iamshaunjp/webpack-playlist/issues"
},
"homepage": "https://github.com/iamshaunjp/webpack-playlist#readme",
"devDependencies": {
"webpack": "^2.3.3"
}
}
and this is package.json located in node_modules/webpack/package.json
{
"_args": [
[
{
"raw": "webpack",
"scope": null,
"escapedName": "webpack",
"name": "webpack",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"C:\\Users\\Djole\\Desktop\\NetNinja\\webpack-playlist"
]
],
"_from": "webpack#latest",
"_id": "webpack#2.3.3",
"_inCache": true,
"_location": "/webpack",
"_nodeVersion": "7.4.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/webpack-2.3.3.tgz_1491205859622_0.6350918470416218"
},
"_npmUser": {
"name": "sokra",
"email": "tobias.koppers#googlemail.com"
},
"_npmVersion": "4.0.5",
"_phantomChildren": {},
"_requested": {
"raw": "webpack",
"scope": null,
"escapedName": "webpack",
"name": "webpack",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/webpack/-/webpack-2.3.3.tgz",
"_shasum": "eecc083c18fb7bf958ea4f40b57a6640c5a0cc78",
"_shrinkwrap": null,
"_spec": "webpack",
"_where": "C:\\Users\\Djole\\Desktop\\NetNinja\\webpack-playlist",
"author": {
"name": "Tobias Koppers #sokra"
},
"bin": {
"webpack": "./bin/webpack.js"
},
"bugs": {
"url": "https://github.com/webpack/webpack/issues"
},
"dependencies": {
"acorn": "^4.0.4",
"acorn-dynamic-import": "^2.0.0",
"ajv": "^4.7.0",
"ajv-keywords": "^1.1.1",
"async": "^2.1.2",
"enhanced-resolve": "^3.0.0",
"interpret": "^1.0.0",
"json-loader": "^0.5.4",
"loader-runner": "^2.3.0",
"loader-utils": "^0.2.16",
"memory-fs": "~0.4.1",
"mkdirp": "~0.5.0",
"node-libs-browser": "^2.0.0",
"source-map": "^0.5.3",
"supports-color": "^3.1.0",
"tapable": "~0.2.5",
"uglify-js": "^2.8.5",
"watchpack": "^1.3.1",
"webpack-sources": "^0.2.3",
"yargs": "^6.0.0"
},
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"devDependencies": {
"beautify-lint": "^1.0.3",
"benchmark": "^2.1.1",
"bundle-loader": "~0.5.0",
"codacy-coverage": "^2.0.1",
"codecov.io": "^0.1.2",
"coffee-loader": "~0.7.1",
"coffee-script": "^1.10.0",
"coveralls": "^2.11.2",
"css-loader": "~0.25.0",
"es6-promise-polyfill": "^1.1.1",
"eslint": "3.12.2",
"eslint-plugin-node": "^3.0.5",
"express": "~4.13.1",
"extract-text-webpack-plugin": "^2.0.0-beta",
"file-loader": "~0.9.0",
"i18n-webpack-plugin": "^0.3.0",
"istanbul": "^0.4.5",
"jade": "^1.11.0",
"jade-loader": "~0.8.0",
"js-beautify": "^1.5.10",
"less": "^2.5.1",
"less-loader": "^2.0.0",
"lodash": "^4.17.4",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.0.0",
"nsp": "^2.6.1",
"raw-loader": "~0.5.0",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"script-loader": "~0.7.0",
"should": "^11.1.1",
"simple-git": "^1.65.0",
"sinon": "^1.17.7",
"style-loader": "~0.13.0",
"url-loader": "~0.5.0",
"val-loader": "~0.5.0",
"vm-browserify": "~0.0.0",
"webpack-dev-middleware": "^1.9.0",
"worker-loader": "~0.7.0"
},
"directories": {},
"dist": {
"shasum": "eecc083c18fb7bf958ea4f40b57a6640c5a0cc78",
"tarball": "https://registry.npmjs.org/webpack/-/webpack-2.3.3.tgz"
},
"engines": {
"node": ">=4.3.0 <5.0.0 || >=5.10"
},
"files": [
"lib/",
"bin/",
"buildin/",
"hot/",
"web_modules/",
"schemas/"
],
"gitHead": "ba24c1b163dc038ed738eb4a57dcb241bf63146d",
"homepage": "https://github.com/webpack/webpack",
"license": "MIT",
"main": "lib/webpack.js",
"maintainers": [
{
"name": "jhnns",
"email": "mail#johannesewald.de"
},
{
"name": "sokra",
"email": "tobias.koppers#googlemail.com"
},
{
"name": "thelarkinn",
"email": "sean.larkin#cuw.edu"
}
],
"name": "webpack",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/webpack.git"
},
"scripts": {
"appveyor:benchmark": "npm run benchmark",
"appveyor:test": "node --max_old_space_size=4096 node_modules\\mocha\\bin\\mocha --harmony test/*.test.js",
"beautify-lint": "beautify-lint 'lib/**/*.js' 'hot/**/*.js' 'bin/**/*.js' 'benchmark/*.js' 'test/*.js'",
"benchmark": "mocha test/*.benchmark.js --harmony -R spec",
"build:examples": "cd examples && node buildAll.js",
"cover": "node --harmony ./node_modules/istanbul/lib/cli.js cover -x '**/*.runtime.js' node_modules/mocha/bin/_mocha -- test/*.test.js",
"cover:min": "node --harmony ./node_modules/.bin/istanbul cover -x '**/*.runtime.js' --report lcovonly node_modules/mocha/bin/_mocha -- test/*.test.js",
"lint": "eslint lib bin hot buildin test/**/webpack.config.js test/binCases/**/test.js examples/**/webpack.config.js",
"lint-files": "npm run lint && npm run beautify-lint",
"nsp": "nsp check --output summary",
"pretest": "npm run lint-files",
"publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish",
"test": "mocha test/*.test.js --harmony --check-leaks",
"travis:benchmark": "npm run benchmark",
"travis:lint": "npm run lint-files && npm run nsp",
"travis:test": "npm run cover:min"
},
"version": "2.3.3",
"web": "lib/webpack.web.js"
}
EDIT:
I've come with following solution in the end:
Add this to your package.json file
"scripts" : {
"build" : "webpack ./entry.js bundle.js"
}
and then type npm run build this will still run the local version because npm will first look in ./node_modules/.bin/
That kind of path is what is used in a git for Windows bash.
See this issue
We use cmdr (http://cmder.net/ ) to emulate console on Windows machines.
Still we had to modify scripts and separate build to clean and build tasks to get it working.
"scripts": {
"clean": "rm -rf dist",
"build": "node_modules/.bin/babel-node -- ./node_modules/webpack/bin/webpack.js --stats --config ./webpack/prod.config.js",
...
},
You can see a similar instruction in this project package.json:
"build-main": "cross-env NODE_ENV=production node -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.electron.js --progress --profile --colors",

Using require() and import for private npm modules failing

I was trying import my private npm module hosted in sinopia. I can see that my module is available in sinopia folder structure.
Able to install module via "npm install --save". I can see it picks it from local registry.
But when I to use it anywhere I am getting "Error: Cannot find module ''
var module = require('some-module');
(tried both)
import module from 'some-module';
ERROR in ./app/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../node_modules/test-module in c:\yotest\app
# ./app/index.js 39:34-77
P.S: I did try installing it as a global node module and it again failed.
EDIT:
This is my package.json of the private module which is a clone from the github project.
{
"_args": [
[
"react-worker-dom",
""
]
],
"_from": "react-worker-dom#latest",
"_id": "react-worker-dom#0.0.3",
"_inCache": true,
"_installable": true,
"_location": "/react-worker-dom",
"_nodeVersion": "5.7.1",
"_npmUser": {},
"_npmVersion": "3.6.0",
"_phantomChildren": {},
"_requested": {
"name": "react-worker-dom",
"raw": "react-worker-dom",
"rawSpec": "",
"scope": null,
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER"
],
"_shasum": "01b520589b7fd9d5533f911108ac6e1f774dab79",
"_shrinkwrap": null,
"_spec": "react-worker-dom",
"_where": "",
"author": {
"email": "******************",
"name": "********************"
},
"bugs": {
"url": "https://github.com/web-perf/react-worker-dom/issues"
},
"dependencies": {
"invariant": "^2.2.0",
"react": "^0.14.3"
},
"description": "ReactJS renderer using Web Workers",
"devDependencies": {
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"browser-perf": "^1.4.3",
"react-dom": "^0.14.3",
"webpack": "^1.12.8",
"webpack-dev-server": "^1.14.1"
},
"directories": {
"test": "test"
},
"dist": {
"shasum": "01b520589b7fd9d5533f911108ac6e1f774dab79",
"tarball": "http://localhost:4873/react-worker-dom/-/react-worker-dom-0.0.3.tgz"
},
"gitHead": "8c8fb15e793151e0169aac82537f4efe628d9986",
"homepage": "http://web-perf.github.io/react-worker-dom",
"license": "BSD-3-Clause",
"main": "dist/worker.js",
"name": "react-worker-dom",
"optionalDependencies": {},
"publishConfig": {
"registry": "http://localhost:4873/"
},
"readme": "ERROR: No README data found!",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/web-perf/react-worker-dom.git"
},
"scripts": {
"build-demo": "webpack --config test/webpack.config.js",
"demo": "webpack-dev-server --config test/webpack.config.js",
"perf": "node test/perf.js"
},
"version": "0.0.3"
}
Webpack config of main project
module.exports = {
entry: './app/index.js',
output: {
filename: 'public/bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
}
]
}
}
Package.json file of the main project
{
"name": "yotest",
"version": "0.0.1",
"main": "index.js",
"scripts": {
"start": "node bin/dev-server"
},
"keywords": [
"webpack",
"redux",
"react",
"react-router",
"kyper"
],
"license": "MIT",
"dependencies": {
"babel-core": "^5.8.22",
"babel-loader": "^5.3.2",
"express": "^4.13.3",
"extract-text-webpack-plugin": "^0.8.2",
"history": "^1.9.1",
"kyper-matter": "^0.1.2",
"lodash": "^3.10.1",
"proxy-middleware": "^0.13.1",
"react": "^0.14.0-rc1",
"react-dom": "^0.14.0-rc1",
"react-hot-loader": "^1.2.8",
"react-redux": "^2.1.2",
"react-router": "^1.0.0-rc1",
"react-worker-dom": "0.0.3",
"redux": "^3.0.0",
"redux-router": "^1.0.0-beta3",
"redux-thunk": "^1.0.0"
},
"devDependencies": {
"css-loader": "^0.16.0",
"eslint": "^1.4.1",
"eslint-config-airbnb": "0.0.8",
"eslint-plugin-react": "^3.2.3",
"node-sass": "^3.3.2",
"redux-devtools": "^2.1.2",
"sass-loader": "^2.0.1",
"style-loader": "^0.12.3",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
}
}
I have reconfigured my NPM private registry and there was a port mismatch which was causing the problem.

mongodb (mongolab) on heroku. 'LoopBack connector "mongodb" is not installed'

I have a nodejs app which runs fine locally. It uses mongodb. I wanted to push it to heroku, so I installed the mongolab addon, 'heroku addons:open mongolab'
and updated the datasources.json file like so;
{
"db": {
"name": "db",
"url": "mongodb://<user:<pwd>#ds037252.mongolab.com:37252/heroku_app37281512",
"connector": "mongodb"
}
}
When I push it to heroku, it fails on startup with the following;
2015-05-29T04:25:39.953257+00:00 heroku[web.2]: Starting process with command node tk/server/server.js 2015-05-29T04:25:41.167153+00:00 app[web.2]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY) 2015-05-29T04:25:41.167177+00:00 app[web.2]: Recommending WEB_CONCURRENCY=1 2015-05-29T04:25:42.158058+00:00 app[web.2]: 2015-05-29T04:25:42.158064+00:00 app[web.2]: 2015-05-29T04:25:42.158063+00:00 app[web.2]: WARNING: LoopBack connector "mongodb" is not installed as any of the following modules: 2015-05-29T04:25:42.158066+00:00 app[web.2]: ./connectors/mongodb 2015-05-29T04:25:42.158068+00:00 app[web.2]: loopback-connector-mongodb 2015-05-29T04:25:42.158069+00:00 app[web.2]: 2015-05-29T04:25:42.158072+00:00 app[web.2]: 2015-05-29T04:25:42.158070+00:00 app[web.2]: To fix, run: 2015-05-29T04:25:42.158073+00:00 app[web.2]: npm install loopback-connector-mongodb
How do I deal with this? Do I need to modify datasources.json somehow?
I am on a heroku free plan. Perhaps it doesn't include mongodb access?
Thanks in advance, Ryan
Here is the package.json;
{
"name": "tk",
"version": "1.0.0",
"main": "server/server.js",
"scripts": {
"pretest": "jshint ."
},
"dependencies": {
"compression": "^1.0.3",
"cors": "^2.5.2",
"errorhandler": "^1.1.1",
"loopback": "^2.14.0",
"loopback-boot": "^2.6.5",
"loopback-datasource-juggler": "^2.19.0",
"serve-favicon": "^2.0.1"
},
"optionalDependencies": {
"loopback-explorer": "^1.1.0"
},
"devDependencies": {
"jshint": "^2.5.6"
},
"repository": {
"type": "",
"url": ""
},
"description": "tk"
}
You're missing the loopback-connector-mongodbfrom your dependencies
Change your package.json to (remove my comment if copy/pasting!)
{
"name": "tk",
"version": "1.0.0",
"main": "server/server.js",
"scripts": {
"pretest": "jshint ."
},
"dependencies": {
"compression": "^1.0.3",
"cors": "^2.5.2",
"errorhandler": "^1.1.1",
"loopback": "^2.14.0",
"loopback-boot": "^2.6.5",
"loopback-datasource-juggler": "^2.19.0",
"loopback-connector-mongodb": "1.9.1", --note the addition of this line
"serve-favicon": "^2.0.1"
},
"optionalDependencies": {
"loopback-explorer": "^1.1.0"
},
"devDependencies": {
"jshint": "^2.5.6"
},
"repository": {
"type": "",
"url": ""
},
"description": "tk"
}
Note-
You can also use npm install loopback-connector-mongodb --save - which will install the package locally, and save the dependency to your package.json

Arguments to path.join must be strings when installing Bower on Mac OSX

I am experiencing the following error when attempting to install Bower on Mac OSX Mavericks.
Craig-R-Mortons-MacBook:crmpicco crmpicco$ node_modules/bower/bin/bower cache clean
Craig-R-Mortons-MacBook:crmpicco crmpicco$ node_modules/bower/bin/bower install
bower not-cached git://github.com/angular/bower-angular-mocks.git#~1.2.9
bower resolve git://github.com/angular/bower-angular-mocks.git#~1.2.9
bower not-cached git://github.com/angular/bower-angular-resource.git#~1.2.9
bower resolve git://github.com/angular/bower-angular-resource.git#~1.2.9
bower not-cached git://github.com/angular/bower-angular.git#~1.2.9
bower resolve git://github.com/angular/bower-angular.git#~1.2.9
bower not-cached git://github.com/angular-ui/ui-router.git#0.2.7
bower resolve git://github.com/angular-ui/ui-router.git#0.2.7
bower not-cached git://github.com/jashkenas/underscore.git#~1.5.2
bower resolve git://github.com/jashkenas/underscore.git#~1.5.2
bower error Arguments to path.join must be strings
Stack trace:
TypeError: Arguments to path.join must be strings
at Object.posix.join (path.js:471:13)
at GitHubResolver._checkout (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/core/resolvers/GitHubResolver.js:54:21)
at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/core/resolvers/GitResolver.js:69:21
at _fulfilled (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:760:13)
at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:574:44
at flush (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
Console trace:
Trace
at StandardRenderer.error (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/renderers/StandardRenderer.js:74:17)
at Logger.<anonymous> (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/bin/bower:109:18)
at Logger.emit (events.js:107:17)
at Logger.emit (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/commands/install.js:27:16
at _rejected (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:808:24)
at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:834:30
at Promise.when (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:752:41)
at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:574:44
System info:
Bower version: 1.3.6
Node version: 0.12.0
OS: Darwin 14.1.0 x64
I came across this post on GitHub, however updating to Bower 1.3.6 has no effect for me - even after doing a bower cache clean and npm cache clean.
This is my package.json
{
"name": "bower",
"version": "1.3.6",
"description": "The browser package manager.",
"author": {
"name": "Twitter"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/bower/bower/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "git://github.com/bower/bower.git"
},
"main": "lib",
"homepage": "http://bower.io",
"engines": {
"node": ">=0.8.0"
},
"dependencies": {
"abbrev": "~1.0.4",
"archy": "0.0.2",
"bower-config": "~0.5.0",
"bower-endpoint-parser": "~0.2.0",
"bower-json": "~0.4.0",
"bower-logger": "~0.2.1",
"bower-registry-client": "~0.1.4",
"cardinal": "~0.4.0",
"chalk": "~0.2.0",
"chmodr": "~0.1.0",
"decompress-zip": "~0.0.3",
"fstream": "~0.1.22",
"fstream-ignore": "~0.0.6",
"glob": "~3.2.1",
"graceful-fs": "~2.0.0",
"handlebars": "~1.0.11",
"inquirer": "~0.3.0",
"junk": "~0.2.0",
"mkdirp": "~0.3.5",
"mout": "~0.7.0",
"nopt": "~2.1.1",
"lru-cache": "~2.3.0",
"open": "~0.0.3",
"osenv": "0.0.3",
"promptly": "~0.2.0",
"q": "~0.9.2",
"request": "~2.27.0",
"request-progress": "~0.3.0",
"retry": "~0.6.0",
"rimraf": "~2.2.0",
"semver": "~2.1.0",
"stringify-object": "~0.1.4",
"sudo-block": "~0.2.0",
"tar": "~0.1.17",
"tmp": "~0.0.20",
"update-notifier": "~0.1.3",
"which": "~1.0.5",
"p-throttler": "~0.0.1"
},
"devDependencies": {
"tmp": "0.0.23",
"bower": "1.3.6",
"expect.js": "~0.2.0",
"grunt": "~0.4.1",
"grunt-simple-mocha": "~0.4.0",
"grunt-contrib-watch": "~0.5.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-exec": "~0.4.2",
"mocha": "~1.12.0",
"nock": "~0.22.0",
"istanbul": "~0.1.42",
"proxyquire": "~0.5.0"
},
"scripts": {
"test": "grunt test"
},
"bin": {
"bower": "bin/bower"
},
"preferGlobal": true,
"bugs": {
"url": "https://github.com/bower/bower/issues"
},
"_id": "bower#1.2.8",
"dist": {
"shasum": "f63c0804a267d5ffaf2fd3fd488367e73dce202f",
"tarball": "http://registry.npmjs.org/bower/-/bower-1.2.8.tgz"
},
"_from": "bower#>=1.2.8 <1.3.0",
"_npmVersion": "1.3.14",
"_npmUser": {
"name": "wibblymat",
"email": "mat#wibbly.org.uk"
},
"maintainers": [
{
"name": "fat",
"email": "jacobthornton#gmail.com"
},
{
"name": "satazor",
"email": "andremiguelcruz#msn.com"
},
{
"name": "wibblymat",
"email": "mat#wibbly.org.uk"
},
{
"name": "paulirish",
"email": "paul.irish#gmail.com"
}
],
"directories": {},
"_shasum": "f63c0804a267d5ffaf2fd3fd488367e73dce202f",
"_resolved": "https://registry.npmjs.org/bower/-/bower-1.2.8.tgz"
}
I just solved this problem today by updating bower to the latest version. As of today, the current version is 1.4.1. You can check the current version by looking in the the package.json on github.
To do update bower, I ran the following command:
npm install -g bower
I think this error was caused because of the following lines that are in my .gitconfig file. This line is there because I am trying to work around being in a corporate environment with proxy servers.
[url "https://"]
insteadOf = git://

Resources