I use Highcharts in some of my projects that I use pure Javascript. Now I start a new project with ReactJS and I install highcharts on it.
npm install -g highcharts highcharts-react-official
But when I start the project using
yarn start
I got the following error:
Module not found: Can't resolve 'highcharts'
This is what I get when I use the command
npm list -g --depth 0
E:\Programas\NodeJS\node-v10.16.3-win-x64
+-- axios#0.19.0
+-- create-react-app#3.1.1
+-- eslint#6.4.0
+-- highcharts#7.2.0
+-- highcharts-react-official#2.2.2
+-- my-app#0.1.0 -> E:\PUC\RelatorioCanvas\reactJs
+-- npm#6.9.0
+-- react#16.9.0
+-- react-scripts#3.1.1
+-- typescript#3.6.3
`-- yarn#1.17.3
npm ERR! peer dep missing: typescript#*, required by #typescript-eslint/eslint-plugin#1.6.0
npm ERR! peer dep missing: typescript#*, required by #typescript-eslint/parser#1.6.0
npm ERR! peer dep missing: typescript#*, required by ts-pnp#1.1.2
npm ERR! peer dep missing: typescript#*, required by #typescript-eslint/parser#1.6.0
npm ERR! peer dep missing: typescript#*, required by #typescript-eslint/typescript-estree#1.6.0
npm ERR! peer dep missing: typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils#3.17.1
npm ERR! peer dep missing: typescript#*, required by #typescript-eslint/typescript-estree#1.6.0
npm ERR! peer dep missing: typescript#*, required by ts-pnp#1.1.2
npm ERR! peer dep missing: eslint#^5.0.0, required by #typescript-eslint/eslint-plugin#1.13.0
npm ERR! peer dep missing: eslint#^5.0.0, required by #typescript-eslint/parser#1.13.0
I already install highcharts and highcharts-react-official, but the issue persists.
How I could fix this issue?
You may have to install the typescript version of highcharts.
npm install #types/highcharts
I found what was causing the problem.
I install everything using the -g option. The packages was installed globally, now I put them as dependencies in my project and use npm install.
It works perfectly now.
This is how my package.json looks now
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"react": "~16.8.6",
"react-dom": "^16.8.6",
"highcharts": "^6.0.0",
"typescript": "^2.8.0",
"highcharts-react-official": "^2.2.0",
"eslint": "^5.0.0",
"react-scripts": "3.0.1"
},
Related
My JS project uses a NPM package called commitizen:
https://github.com/commitizen/cz-cli
commitizen is added to my devDependencies in package.json file.
commitizen uses internally a package called opencollective as you can see here: https://github.com/commitizen/cz-cli/blob/master/package.json
commitizen on postinstall hook is calling opencollective postinstall which is supposed to run opencollective package binary.
Locally I've no problems running the postinstall hook, however, when I build my project on my Jenkins CI box I get this error when it runs the postinstall hook of commitizen package
sh: 1: opencollective: not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! commitizen#2.10.1 postinstall: `opencollective postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the commitizen#2.10.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I tried to add node_modules/opencollective/dist/bin dir to the PATH but with no luck, I think because the opencollective alias is defined in opencollective package.json
Any idea about how to be able to run opencollective command without installing globally opencollective package?
Thank you!
I tried 'RNVectorIcons' package in my react native project using the following link react-native-vector-icons.I used pod install command in my terminal.But I got the following error in my terminal window.
Analyzing dependencies
Fetching podspec for `RNVectorIcons` from `../node_modules/react-native-vector-icons`
Downloading dependencies
Installing RNVectorIcons (4.6.0)
Installing React (0.11.0)
[!] /bin/bash -c
set -e
npm install --production
npm WARN deprecated connect#2.8.3: connect 2.x series is deprecated
npm WARN deprecated babel-core#5.8.21: Babel 5 is no longer being maintained. Upgrade to Babel 6.
npm WARN deprecated graceful-fs#3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated line-numbers#0.2.0: Copy its ~20 LOC directly into your code instead.
npm WARN deprecated tough-cookie#1.2.0: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated coffee-script#1.6.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated formatio#1.1.1: This package is unmaintained. Use #sinonjs/formatio instead
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git://github.com/facebook/react.git
npm ERR!
npm ERR! undefined
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macmini1/.npm/_logs/2018-06-21T12_59_11_182Z-debug.log
my package.json file look like the following:
{
"name": "sample",
"version": "0.0.1",
"private": true,
"scripts": {
"gulp": "gulp"
},
"dependencies": {
"eslint": "4.19.1",
"eslint-config-airbnb": "16.1.0",
"eslint-config-airbnb-base": "12.1.0",
"eslint-config-rallycoding": "3.2.0",
"eslint-import-resolver-webpack": "0.10.0",
"eslint-plugin-import": "2.12.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-react": "7.8.2",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-vector-icons": "4.6.0",
"react-navigation": "2.3.1"
},
"devDependencies": {
"babel-jest": "23.0.1",
"babel-preset-react-native": "4.0.0",
"jest": "23.1.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
debug.log file is
1609 verbose stack Error: exited with error code: 128
1609 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/finished.js:12:19)
1609 verbose stack at ChildProcess.emit (events.js:182:13)
1609 verbose stack at maybeClose (internal/child_process.js:961:16)
1609 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
1610 verbose cwd /Users/macmini1/Library/Caches/CocoaPods/Pods/Release/React/0.11.0-ab1a2
1611 verbose Darwin 17.0.0
1612 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--production"
1613 verbose node v10.4.1
1614 verbose npm v6.1.0
1615 error Error while executing:
1615 error /usr/bin/git ls-remote -h -t git://github.com/facebook/react.git
1615 error
1615 error undefined
1615 error exited with error code: 128
1616 verbose exit [ 1, true ]
How to solve this issue?
Could you provide the contents of the debug log? Did you only experience this issue since adding this package?
Can you also post the content of your package.json file?
Do also please have look at this question/solution, it does seem like the problem you're having: react-native init AwesomeProject unable to connect to github.com
Update
It could be related to the way github is being accessed. Could you try running the following command before trying it again?
git config --global url."https://".insteadOf git://
I'm running this Jenkins Image in Docker.
In one of my builds, I'm attempting to install the following packages:
json
"devDependencies": {
"#babel/core": "^7.0.0-beta.40",
"#babel/preset-env": "^7.0.0-beta.40",
"babel-loader": "^8.0.0-beta.0",
"css-loader": "^0.28.11",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.1.0",
"image-webpack-loader": "^4.2.0",
"node-sass": "^4.8.3",
"sass-loader": "^6.0.7",
"style-loader": "^0.20.3",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.13",
"webpack-dev-server": "^3.1.1"
}
However, the build keeps failing when attempting to install pngquant-bin#4.0.0:
> node-sass#4.8.3 install /var/jenkins_home/workspace/crypto-coaster/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.8.3/linux-x64-57_binding.node
Download complete
Binary saved to /var/jenkins_home/workspace/crypto-coaster/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /var/jenkins_home/.npm/node-sass/4.8.3/linux-x64-57_binding.node
> cwebp-bin#4.0.0 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/cwebp-bin
> node lib/install.js
✔ cwebp pre-build test passed successfully
> gifsicle#3.0.4 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
> mozjpeg#5.0.0 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/mozjpeg
> node lib/install.js
✔ mozjpeg pre-build test passed successfully
> optipng-bin#3.1.4 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/optipng-bin
> node lib/install.js
✔ optipng pre-build test passed successfully
> pngquant-bin#4.0.0 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/pngquant-bin
> node lib/install.js
⚠ The `/var/jenkins_home/workspace/crypto-coaster/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
⚠ pngquant pre-build test failed
ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at Promise.all.then.arr (/var/jenkins_home/workspace/crypto-coaster/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
I've updated the Docker image, tried different versions of Node (7.9.0, 8.11.1) and keep running into the same error.
No idea how to fix get pngquant-bin working on this build.
Any assistance would be greatly appreciated.
According to this issue https://github.com/imagemin/pngquant-bin/issues/78.
I use this dockerfile to create a new image and it work fine.
FROM jenkins/jenkins:lts
USER root
RUN apt-get update && apt-get install -y gcc make libpng-dev
USER jenkins
The below error occurred while in attempt to deploy my app to the mobile phone for testing.
the app function in the Xcode Simulator, and was able to export to the app into iPhone for testing.
after running the npm start the following error occurred.
while the iPhone app did load but count not connect to development server due to not able to npm start.
And yes both the iPhone and my computer is on the same wireless network.
┌────────────────────────────────────────────────────────────────────────────┐
│ Running packager on port 8081. │
│ │
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/Users/jimmylin/dev/ga/WalkingTour/SohoDuck
[10:40:02 AM] <START> Building Dependency Graph
[10:40:02 AM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot
React packager ready.
ERROR: Unknown option --no-pretty
ERROR: Unknown option --no-pretty
Watchman: watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty
ERROR watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty
Error: watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty
at ChildProcess.<anonymous> (/Users/jimmylin/dev/ga/WalkingTour/SohoDuck/node_modules/fb-watchman/index.js:198:18)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:477:12)
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/Cellar/node/5.9.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.9.1
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! SohoDuck#0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SohoDuck#0.0.1 start script 'node node_modules/react-native/local-cli/cli.js start'.
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 SohoDuck package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/react-native/local-cli/cli.js start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs SohoDuck
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls SohoDuck
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jimmylin/dev/ga/WalkingTour/SohoDuck/npm-debug.log
any suggestion would be greatly appreciated.
Correct installation of dependencies
Uninstall watchman and flow via npm and homebrew
Install watchman and flow only via homebrew
brew install watchman
brew install flow
So I have been trying for the last 3 hours to get web storm set up on my new mac. I'm having trouble getting the iOS-sim set up and it just gives me an error
Failed at the ios-sim#3.1.1 preinstall script 'rake build'.
npm ERR! This is most likely a problem with the ios-sim package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! rake build
npm ERR! You can get their info via:
npm ERR! npm owner ls ios-sim
npm ERR! There is likely additional logging output above.
I've tried every google link out there and I still am at a loss.
Any thoughts?
Here is an error message I get when installing phonegap
Brentons-MBP:~ brentonpierce$ sudo npm install -g phonegap
Password:
npm WARN engine npm#1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.12.3","npm":"2.7.5"})
npm WARN engine cordova-js#3.9.0: wanted: {"node":"~0.10.x"} (current: {"node":"0.12.3","npm":"2.7.5"})
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.3","npm":"2.7.5"})
> ws#0.4.31 install /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/socket.io/node_modules/engine.io/node_modules/ws > (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
npm WARN installMany normalize-package-data was bundled with npm#1.3.4, but bundled package wasn't found in unpacked tree
> ws#0.4.31 install /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws > (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o /usr/local/bin/phonegap -> /usr/local/lib/node_modules/phonegap/bin/phonegap.js
phonegap#5.0.0-0.28.0 /usr/local/lib/node_modules/phonegap
├── pluralize#0.0.4
├── colors#0.6.0-1
├── semver#1.1.0
├── minimist#0.1.0
├── qrcode-terminal#0.9.4
├── shelljs#0.1.4
├── phonegap-build#0.9.1 (colors#0.6.2, qrcode-terminal#0.8.0, shelljs#0.0.9, optimist#0.3.7, phonegap-build-api#0.3.3)
├── prompt#0.2.11 (revalidator#0.1.8, pkginfo#0.3.0, read#1.0.5, winston#0.6.2, utile#0.2.1)
├── cordova#5.0.0 (underscore#1.7.0, q#1.0.1, nopt#3.0.1, cordova-lib#5.0.0)
└── connect-phonegap#0.16.0 (home-dir#0.1.2, connect-inject#0.3.2, ip#0.3.1, walkdir#0.0.8, request-progress#0.3.1, shelljs#0.2.6, http-proxy#1.8.1, request#2.33.0, tar#0.1.19, node-static#0.7.0, gaze#0.4.3, localtunnel#1.3.0, archiver#0.14.3, useragent#2.0.8, connect#2.12.0, socket.io#1.0.4)
Xcode 6 is required for ios-sim to work.
Please check that you have it installed.
If it is installed, run it at least once.