I published an npm package named container-object-model but currently, it's not visible in npmjs.com.
but I can install it using yarn add container-object-model.
(files in node_modules)
package.json
{
"name": "container-object-model",
"version": "0.0.5",
"description": "Container Object Model",
"main": "./dist/container-object-model.js",
"types": "./dist/container-object-model.d.ts",
"keywords": ["container-object-model", "container"],
"license": "MIT",
"scripts": {
"prepare": "npm run build",
"start": "webpack",
"build": "webpack --env=build",
"postbuild": "tsc ./src/container-object-model.ts --declaration --esModuleInterop --outDir ./dist --emitDeclarationOnly",
"demo": "webpack-dev-server --env=demo"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rannie-peralta/container-object-model.git"
},
"author": "Rannie Peralta",
"bugs": {
"url": "https://github.com/rannie-peralta/container-object-model/issues"
},
"homepage": "https://github.com/rannie-peralta/container-object-model#readme",
"devDependencies": {
"awesome-typescript-loader": "^5.2.1",
"clean-webpack-plugin": "^2.0.1",
"css-loader": "^2.1.1",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"typescript": "^3.4.3",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.3.1"
},
"dependencies": {
"#types/lodash.throttle": "^4.1.6",
"#types/memoizee": "^0.4.2",
"#types/shortid": "^0.0.29",
"decimal.js": "^10.1.1",
"lodash.throttle": "^4.1.1",
"memoizee": "^0.4.14",
"resize-observer-polyfill": "^1.5.1",
"shortid": "^2.2.14"
}
}
Also here is the other issue I found when I tried to import it:
Related
I learn React and JavaScript.
After running npm install I see that react and react-dom is in my node_modules, why is that?
I have a small problem when using the library component that I get duplicate react error.
So I try to learn how to fix this
here is the package.json
{
"name": "notistack",
"version": "1.0.10",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
"main": "src/index.js",
"module": "dist/notistack.esm.js",
"types": "src/index.d.ts",
"license": "MIT",
"author": {
"name": "Hossein Dehnokhalaji",
"email": "hossein.dehnavi98#yahoo.com",
"url": "https://github.com/iamhosseindhv/notistack"
},
"homepage": "https://www.iamhosseindhv.com/notistack",
"repository": {
"url": "git+https://github.com/iamhosseindhv/notistack.git",
"type": "git"
},
"scripts": {
"build": "tsdx build --transpileOnly --entry ./src/index.js",
"prebuild": "npm run docs",
"prepublishOnly": "npm run build",
"docs": "rimraf typedoc.json && typedoc --tsconfig",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"peerDependencies": {
"#material-ui/core": "^4.12.3",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
},
"devDependencies": {
"#babel/preset-react": "^7.8.3",
"#material-ui/core": "^4.9.5",
"#types/node": "^13.9.0",
"#types/react": "^16.9.23",
"#types/react-dom": "^16.9.5",
"#types/react-is": "^16.7.1",
"#typescript-eslint/eslint-plugin": "^3.9.1",
"#typescript-eslint/parser": "^3.9.1",
"babel-plugin-optimize-clsx": "^2.6.1",
"eslint": "^7.7.0",
"eslint-config-airbnb": "~18.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.6",
"rimraf": "^3.0.2",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-copy": "^3.3.0",
"tsdx": "^0.13.2",
"typedoc": "^0.16.11",
"typescript": "^3.8.3"
},
"dependencies": {
"clsx": "^1.1.0",
"hoist-non-react-statics": "^3.3.0"
},
"bugs": {
"url": "https://github.com/iamhosseindhv/notistack/issues"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/notistack"
},
"contributors": [
"Hossein Dehnokhalaji (https://www.iamhosseindhv.com/)"
],
"keywords": [
"notistack",
"enqueueSnackbar",
"snackbarprovider",
"useSnackbar",
"multiple",
"react",
"javascript",
"material-ui",
"toast",
"redux",
"snackbar",
"stacked",
"notification",
"material design",
"hossein",
"dehnokhalaji",
"iamhosseindhv"
]
}
Okay so my npm audit requires me to review this file manually and it apparently needs the newest version of axios(0.21.1) so how can I rebuild it?
This is the error btw:
Visit https://go.npm.me/audit-guide for additional guidance
High Server-Side Request Forgery
Package axios
Patched in >=0.21.1
Dependency of apify
Path apify > apify-client > axios
{
"_from": "axios#^0.20.0",
"_id": "axios#0.20.0",
"_inBundle": false,
"_integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
"_location": "/apify-client/axios",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "axios#^0.20.0",
"name": "axios",
"escapedName": "axios",
"rawSpec": "^0.20.0",
"saveSpec": null,
"fetchSpec": "^0.20.0"
},
"_requiredBy": [
"/apify-client"
],
"_resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
"_shasum": "057ba30f04884694993a8cd07fa394cff11c50bd",
"_spec": "axios#^0.20.0",
"_where": "C:\\Users\\Janek\\Desktop\\apify7\\my-new-project\\node_modules\\apify-client",
"author": {
"name": "Matt Zabriskie"
},
"browser": {
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
},
"bugs": {
"url": "https://github.com/axios/axios/issues"
},
"bundleDependencies": false,
"bundlesize": [
{
"path": "./dist/axios.min.js",
"threshold": "5kB"
}
],
"dependencies": {
"follow-redirects": "^1.10.0"
},
"deprecated": "Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410",
"description": "Promise based HTTP client for the browser and node.js",
"devDependencies": {
"bundlesize": "^0.17.0",
"coveralls": "^3.0.0",
"es6-promise": "^4.2.4",
"grunt": "^1.0.2",
"grunt-banner": "^0.6.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^20.1.0",
"grunt-karma": "^2.0.0",
"grunt-mocha-test": "^0.13.3",
"grunt-ts": "^6.0.0-beta.19",
"grunt-webpack": "^1.0.18",
"istanbul-instrumenter-loader": "^1.0.0",
"jasmine-core": "^2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.1.0",
"karma-jasmine": "^1.1.1",
"karma-jasmine-ajax": "^0.1.13",
"karma-opera-launcher": "^1.0.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.2.0",
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"load-grunt-tasks": "^3.5.2",
"minimist": "^1.2.0",
"mocha": "^5.2.0",
"sinon": "^4.5.0",
"typescript": "^2.8.1",
"url-search-params": "^0.10.0",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"homepage": "https://github.com/axios/axios",
"jsdelivr": "dist/axios.min.js",
"keywords": [
"xhr",
"http",
"ajax",
"promise",
"node"
],
"license": "MIT",
"main": "index.js",
"name": "axios",
"repository": {
"type": "git",
"url": "git+https://github.com/axios/axios.git"
},
"scripts": {
"build": "NODE_ENV=production grunt build",
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"examples": "node ./examples/server.js",
"fix": "eslint --fix lib/**/*.js",
"postversion": "git push && git push --tags",
"preversion": "npm test",
"start": "node ./sandbox/server.js",
"test": "grunt test && bundlesize",
"version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
},
"typings": "./index.d.ts",
"unpkg": "dist/axios.min.js",
"version": "0.20.0"
}
You can just use the command npm install axios and it will automatically update axios and the package.json for you.
This worked for me:
$ npm uninstall axios
$ npm i axios --save
if i change my host to a custom one, then i get the error above. This only happens in edge
I have tried to build other application in different techs to see if it was my language but its not
{
"name": "openlayers",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "parcel index.html --host development.landwebni.gov.uk --port 9095",
"build": "parcel build --public-url . index.html"
},
"author": "",
" license": "ISC",
"dependencies": {
"#babel/core": "^7.8.3",
"app-root-path": "^3.0.0",
"authenticate": "^0.1.5",
"babel-preset-es2015": "^6.24.1",
"babel-upgrade": "^1.0.1",
"commonjs": "0.0.1",
"config": "^3.2.5",
"core-js": "^3.6.4",
"document-ready": "^2.0.2",
"eazy-logger": "^3.0.2",
"fs": "0.0.1-security",
"jquery": "^3.4.1",
"leaflet": "^1.6.0",
"ol": "^6.1.1",
"ol-contextmenu": "^4.0.0",
"ol-hashed": "^2.0.0",
"ol-layerswitcher": "^3.5.0",
"proj4": "^2.6.0",
"sidebar-v2": "^0.4.0",
"simple-datatables": "^2.1.9",
"simple-node-logger": "^18.12.24",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^4.4.1"
},
"devDependencies": {
"babel-preset-env": "^1.7.0",
"parcel-bundler": "^1.12.4"
},
" description": ""
}
I'm running into an issue where my build works fine on master branch, but on a sub-branch it is producing an error of "Uncaught ReferenceError: react is not defined". The package.json for both branches are a little different, but I'm still unsure why the sub-branch is showing that error as React is listed as a dependency for both.
master-branch:
{
"name": "master-branch",
"version": "0.0.1",
"description": "master-branch",
"main": "lib/index.js",
"pre-commit": [
"test"
],
"peerDependencies": {
"antd": "3.x",
"react": "16.x",
"react-dom": "16.x"
},
"scripts": {
"build": "rm -rf lib && NODE_ENV=production webpack --progress --config webpack.config.js ",
"docs:clean": "rm -rf docs/dist",
"docs:deploy": "yarn docs && gh-pages -d docs/dist",
"docs": "esdoc && yarn test:coverage && node docs/post-doc",
"test": "NODE_ENV=test jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"watch": "watch-run -p 'src/**' yarn build",
"storybook": "start-storybook -p 6006",
"storybook:watch": "concurrently \"yarn watch\" \"yarn storybook\"",
"storybook:build": "build-storybook -c .storybook -o build-stories"
},
"babel": {
"presets": [
"es2015",
"stage-0",
"react"
],
"plugins": [
"transform-class-properties",
"transform-custom-element-classes",
"transform-es2015-classes",
"transform-export-extensions"
]
},
"jest": {
"coverageDirectory": "docs/dist/coverage"
},
"dependencies": {
"antd": "3.6.5",
"async": "^2.6.0",
"axios": "^0.19.0",
"chance": "^1.0.13",
"classnames": "^2.2.5",
"jquery": "^3.2.1",
"lodash": "^4.17.15",
"md5": "^2.2.1",
"react-jss": "^8.4.0",
"store": "^2.0.12"
},
"devDependencies": {
"#storybook/addon-actions": "^5.2.5",
"#storybook/addon-links": "^5.2.5",
"#storybook/react": "^5.2.5",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-custom-element-classes": "^0.1.0",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"esdoc": "^1.0.3",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-react-plugin": "^1.0.1",
"esdoc-standard-plugin": "^1.0.0",
"gh-pages": "^1.0.0",
"jest": "^23.6.0",
"pre-commit": "^1.2.2",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-test-renderer": "^16.0.0",
"url-loader": "^1.1.1",
"watch-run": "^1.2.5",
"webpack": "^3.8.1",
"webpack-cli": "^2.0.4"
},
"author": "",
"homepage": "",
"license": "MIT",
"repository": "",
"keywords": [
"react-component"
]
}
sub-branch:
{
"name": "sub-branch",
"version": "0.0.1",
"description": "sub-branch",
"main": "lib/index.js",
"pre-commit": [
"test"
],
"peerDependencies": {
"antd": "3.6.5",
"classnames": "^2.2.6",
"prop-types": "^15.7.2",
"react": "16.8",
"react-dom": "^16.9.0",
"react-jss": "^8.6.1"
},
"scripts": {
"build": "rm -rf lib && NODE_ENV=production webpack --mode production --progress --config webpack.config.js ",
"docs:clean": "rm -rf docs/dist",
"docs:deploy": "yarn docs && gh-pages -d docs/dist",
"docs": "esdoc && yarn test:coverage && node docs/post-doc",
"test": "NODE_ENV=test jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"watch": "watch-run -p 'src/**' yarn build",
"storybook": "start-storybook -p 6006",
"storybook:watch": "concurrently \"yarn watch\" \"yarn storybook\""
},
"jest": {
"coverageDirectory": "docs/dist/coverage"
},
"dependencies": {
"#storybook/addon-storysource": "^5.2.0",
"antd": "^3.23.3",
"axios": "^0.16.2",
"chance": "^1.0.13",
"classnames": "^2.2.6",
"lodash": "^4.17.4",
"md5": "^2.2.1",
"prop-types": "^15.7.2",
"react": "16.8",
"react-dom": "16.8",
"react-jss": "^8.6.1",
"store": "^2.0.12"
},
"devDependencies": {
"#babel/cli": "^7.6.0",
"#babel/core": "^7.6.0",
"#babel/plugin-proposal-class-properties": "^7.5.5",
"#babel/plugin-proposal-export-default-from": "^7.5.2",
"#babel/plugin-syntax-export-extensions": "^7.0.0-beta.32",
"#babel/plugin-transform-classes": "^7.5.5",
"#babel/preset-env": "^7.6.0",
"#babel/preset-react": "^7.0.0",
"#storybook/addon-actions": "^5.2.0",
"#storybook/addon-notes": "^5.2.1",
"#storybook/react": "^5.2.0",
"babel-loader": "^8.0.6",
"esdoc": "^1.0.3",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-react-plugin": "^1.0.1",
"esdoc-standard-plugin": "^1.0.0",
"flexbox-react": "^4.4.0",
"gh-pages": "^1.0.0",
"jest": "^24.9.0",
"pre-commit": "^1.2.2",
"react-popper-tooltip": "^2.8.3",
"react-test-renderer": "^16.9.0",
"react-textarea-autosize": "^7.1.0",
"simplebar-react": "^1.3.0-alpha.1",
"storybook-addon-react-docgen": "^1.2.18",
"url-loader": "^1.1.1",
"watch-run": "^1.2.5",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.8"
},
"author": "",
"homepage": "",
"license": "MIT",
"repository": "",
"keywords": [
"react-component"
]
}
on master-branch react is defined as "devDependency", but on sub-branch as "dependency". I belive on sub-branch it also should be defined as "devDependency"
I have the following library https://github.com/codyc4321/react-data-components-updated
I installed it in my React project like npm i ~/react-data-components-updated
Now running my node server I get:
ERROR in /Users/cchilders/react-data-components-updated/lib/index.js
Module build failed: Error: Couldn't find preset "react-hmre" relative to directory "/Users/cchilders/react-data-components-updated"
at /Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map (native)
at OptionManager.resolvePresets (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/cchilders/work_projects/myproject/node_modules/babel-loader/lib/index.js:46:20)
# ./client/components/tables/MyDataTable.js 64:16-56
# ./client/controllers/MyController.js
# ./client/main.js
# multi webpack-hot-middleware/client ./client/main.js
In my library I have
.babelrc
{
"presets": [
"es2015",
"react",
"stage-1",
"react-hmre"
]
}
package.json
{
"name": "react-data-components-updated",
"version": "0.1.0",
"description": "React data components updated with some fixes",
"keywords": [
"pagination",
"react",
"react-component",
"table"
],
"license": "MIT",
"main": "./lib/index",
"files": [
"css",
"lib",
"dist",
"src"
],
"repository": {
"type": "git",
"url": "https://github.com/codyc4321/react-data-components-updated"
},
"dependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"lodash": "^4.13.1",
"prop-types": "^15.5.10"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0"
},
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-eslint": "^7.0.0",
"babel-jest": "^20.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-lodash": "^3.2.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"eslint": "^4.1.1",
"eslint-plugin-react": "^7.1.0",
"flow-bin": "^0.49.1",
"husky": "^0.14.1",
"jest": "^20.0.4",
"lint-staged": "^4.0.0",
"lodash-webpack-plugin": "^0.11.4",
"prettier": "^1.5.2",
"react": "^15.1.0",
"react-addons-test-utils": "^15.1.0",
"react-dom": "^15.1.0",
"react-redux": "^4.4.5",
"react-test-renderer": "^15.6.1",
"redux": "^3.5.2",
"rimraf": "^2.4.3",
"webpack": "^3.1.0",
"webpack-dev-server": "^2.5.0"
},
"scripts": {
"build": "webpack && babel src -d lib",
"check": "flow check",
"clean": "rimraf lib dist coverage",
"lint": "eslint src",
"precommit": "lint-staged",
"prepublish": "npm run clean && npm run build",
"start": "webpack-dev-server -d --config example/webpack.config.js",
"test": "npm run lint && npm run check && jest"
},
"lint-staged": {
"*.js": [
"prettier --write --single-quote --trailing-comma all",
"git add"
]
},
"jest": {
"roots": [
"src"
]
}
}
How can I fix this react-hmre error?
You have missed the package, please install it by click it babel-preset-react-hmre