unable to run npm start for react-native project - reactjs

This is my first attempt at running react-native project. Followed all the instructions mentioned at react-native side. and ran 'npm start'
Getting below error in command prompt :
ERROR watchman--no-pretty get-sockname returned with exit code null dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/bin/watchman
Reason: image not found
Error: watchman--no-pretty get-sockname returned with exit code null dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/bin/watchman
Reason: image not found
at ChildProcess.<anonymous> (/Users/z013mrq/AwesomeProject/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:198:18)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)

Try reinstalling watchman:
npm r -g watchman
brew update && brew upgrade
brew install watchman
If that doesn't fix it, try the answers posted here.
Try to re-install libtool by:
brew reinstall libtool --universal && brew unlink libtool && brew link
libtool
If won't help, try to remove it completely and re-try above
again:
brew uninstall libtool

Related

npx create-react-app fails while executing yarnpkg on big sur

I've found a few posts on this already but none of the existing solutions seem to work.
OSX Big Sur
yarn 1.22.10
npm 7.0.11
I updated xcode developer tools.
I deleted npm cache
I removed .npm and .yarnrc folders
And then trying to start a new React app with npx create-react-app and getting the following:
error An unexpected error occurred: "expected workspace package to exist for \"eslint\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/gdboling/Projects/BalancedComp/clients/packages/rewards/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts cra-template --cwd /Users/gdboling/Projects/BalancedComp/clients/packages/rewards has failed.
The log file has:
26 verbose stack Error: command failed
26 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/#npmcli/promise-spawn/index.js:64:27)
26 verbose stack at ChildProcess.emit (node:events:329:20)
26 verbose stack at maybeClose (node:internal/child_process:1055:16)
26 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
Got the same problem on macOS Big Sur. I generally use brew to install my packages. Simply upgrading the packages solved it for me:
brew upgrade
and afterwards
brew cleanup
You may need to restart npm after brew finished upgrading.
Had the exact same issue with a Vue project. I am using OSX Catalina and npm 7.0.8.
My error was resolved with a post found here: https://forum.quasar-framework.org/topic/6258/errors-updating-to-v2/5
With the answer of FrankM:
Check your index.template.html.
Replace htmlWebpackPlugin.options.ctx.mode with ctx.mode
Maybe this helps and you have a similar entry anywhere in your project.

libstdc++ is deprecated; move to libc++ when installing Babel using npm on Catalina

my error output looks like this:
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/simonhurst/PycharmProjects/supervalet/node_modules/fsevents
gyp ERR! node -v v6.17.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
When running
npm i -D #babel/core babel-loader #babel/preset-env #babel/preset-react babel-plugin-transform-class-properties
Now I can see the issue is here :
library not found for -lstdc++
However have zero idea how to resolve it.
Been searching the web and stackoverflow - messing around with uninstalling Xcode reinstalling exode looking hombrew... etc but as of yet absolutely no joy.
I'm Python dev by trade so node is most certainly not my expertise. If someone could shed some light on how to resolve this issue that would be wonderful. I can't believe I'm the only one having it.
Thanks
Wow after reading many posts and many issues on GitHub... the solution in my case wasn't making sure I had Xcode installed, and the corresponding command line tools installed and making sure I'd accepted the Apple Licence agreement. It was simply a question of updating the version of node that I was using. In my case I was using version 6.x this was the version that came pre-installed on my brand new mac. Annoying. Visit https://nodejs.org/en/ to upgrade your node version. At the time of writing this the versions I upgraded to was 12.16.1 - in the event that's helpful to a future reader of this question 'n answer session :)
Really feel the error message could have been way more helpful here, but hey that's how things are some times.

react-native installing react-native-gesture-handler just hands and doesn't install

I am trying to install react-navigation so I can add navigation to my react app. I am following the instructions on https://facebook.github.io/react-native/docs/navigation but I can not get it to all install properly.
I am on a windows machine and have react versions
"react": "16.9.0",
"react-native": "0.61.5",
I installed react-native
npm install -g react-native
I installed the cli
npm install -g --save react-native-cli
I created my app
react-native init MyReactNativeApp
I cd'ed into that folder
cd MyReactNativeApp
I installed react-navigation
npm install -g --save react-navigation
npm install #react-navigation/native #react-navigation/stack
I am trying to run the next step which is the following, however it just hangs
If you have an bare React Native project, install the dependencies with npm:
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
Further investigations shows i can install all the following all ok
npm install react-native-reanimated
npm install react-native-screens
npm install react-native-safe-area-context
npm install #react-native-community/masked-view
Its the install of "react-native-gesture-handler" which just hangs, i do not get any error message
npm --save install react-native-gesture-handler
[..................] - loadDep:prop-types: sill resolveWithNewModule react-native-gesture-handler#1.5.6 checking installable status
I have searched the net and tried a number of things, such as those below but nothing works
run my command window as an administrator
removed the react-native-safe-area-view folder from node-modules and tried again
put my GIT home on my PATH
I believe without this i can not use react-navigation and my app fails to run.
I do not understand why this is not working when i am following the official documentation.
UPDATE
Eventually it failed (after about 10 mins) with
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t
https://github.com/naver/hammer.js.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! C:\Users\MYUSER\AppData\Roaming\npm-cache\_logs\2020-02-
12T13_26_03_301Z-debug.log
The log file contents do not say anything more than the error
43 error Error while executing:
43 error C:\Program Files\Git\cmd\git.EXE ls-remote -h -t
https://github.com/naver/hammer.js.git
43 error
43 error undefined
43 error exited with error code: 128
GIT on my machine
>which git
C:\Program Files\Git\cmd\git.EXE
>git --version
git version 2.21.0.windows.1
Confirm you have git installer and available in command line
Since you are using rn 61, you should initialize your project with npx
npx react-native init AwesomeProject
The error implied that GIT can not access the given site. I'm behind a corporate Firewall. I set a proxy in git and I can now install "react-native-gesture-handler"
git config --global http.proxy http://host:port

(FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)

When I run react-scripts test --env=jsdom it always display:
2018-07-04 09:57 node[61600] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2018-07-04 09:57 node[61600] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2018-07-04 09:57 node[61600] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:167
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (fs.js:1370:28)
Emitted 'error' event at:
at FSEvent.FSWatcher._handle.onchange (fs.js:1376:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stampling#0.1.0 test: `react-scripts test --env=jsdom`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stampling#0.1.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alexis/.npm/_logs/2018-07-04T07_57_39_147Z-debug.log
npm version: 6.1.0
I am under macOS High Sierra 10.13.5
I have seen other issue like this but they have that with watchman that I don't use.
Thanks for help.
try it:
brew install watchman
It worked to me.
I ran into the same issue and this is what it worked for me:
1) delete package-lock.json
2) npm cache clean --force
3) wait 1 min.
4) npm-install, this will create our new package-lock.json
( npm notice created a lockfile as package-lock.json )
Found out my global packages were corrupted
"react-dom": "^16.0.0",
<<<<<<< HEAD
"react-router-dom": "^4.3.1",
=======
"react-router-dom": "^4.1.2",
>>>>>>> 83340ffacc1ea542b788d66484413578afd4ef4c
"react-scripts": "^1.1.4"
I had this issue because of a wrong version of node installed.
I got the same issue in react native expo project
I have tried many ways
Restart server
yarn reset then restart the server
Restart system
update brew
Close all files and apps (As it was showing too many files open)
But nothing worked for me
- brew install watchman
- brew upgrade watchman
- Restart expo server
Worked for me finally
I found the problem.
When I put a single file in my home directory, it gives me same error. The reason is, it is trying to monitor all files under all subdirectories which is huge!!!!
when I run the command inside the folder project, its no longer gives me any error
Hope this helps.

Trouble building mean project with MEAN.io

I'm having problems building a project with MEAN.io. I run through all of the steps given by MEAN.io but I receive the following error:
npm ERR! Cannot read property '0' of undefined
Steps:
I created a brand new ubuntu instance with c9.
Upgraded npm to 5.3.0
Upgraded node with nvm to 8.2.1
Went to mean.io and followed there instructions
sudo npm install -g mean-cli
mean init testapp
got the following error
error:
Cloning into 'testapp'...
/home/ubuntu/.npm/_locks/npm-eb15ca27eba77bee.lock
/home/ubuntu/.npm/anonymous-cli-metrics.json
There are 3 files in your ~/.npm owned by root
Please change the permissions by running - chown -R `whoami` ~/.npm
/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/mean-cli/lib/install.js:52
if (err) throw err;
^
ROOT PERMISSIONS IN NPM
ran the following command: sudo chown -Rwhoami~/.npm
Deleted the testapp folder that mean init created
Rerean the command: mean init testapp
Appears that the project was successfully created
I got the following message:
message:
Install node package dependencies:
$ cd testapp && npm install
Bower install should be triggered for client side dependencies.
If it did not run invoke it manually...
$ cd testapp && bower install
Run the app by running:
$ cd testapp and then run..
$ gulp
ran cd testapp && npm install
Got the following output
output:
> node-sass#4.5.3 install /home/ubuntu/workspace/testapp/node_modules/node-sass
> node scripts/install.js
Cached binary found at /home/ubuntu/.npm/node-sass/4.5.3/linux-x64-57_binding.node
> node-sass#4.5.3 postinstall /home/ubuntu/workspace/testapp/node_modules/node-sass
> node scripts/build.js
Binary found at /home/ubuntu/workspace/testapp/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
> angular-starter#6.0.0 postinstall /home/ubuntu/workspace/testapp
> npm run webdriver:update
> angular-starter#6.0.0 webdriver:update /home/ubuntu/workspace/testapp
> webdriver-manager update
[19:17:48] I/file_manager - creating folder /home/ubuntu/workspace/testapp/node_modules/protractor/node_modules/webdriver-manager/selenium
[19:17:49] I/update - chromedriver: unzipping chromedriver_2.31.zip
[19:17:49] I/update - chromedriver: setting permissions to 0755 for /home/ubuntu/workspace/testapp/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.31
[19:17:50] I/update - geckodriver: unzipping geckodriver-v0.18.0.tar.gz
[19:17:50] I/update - geckodriver: setting permissions to 0755 for /home/ubuntu/workspace/testapp/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.18.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (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"})
Tried running gulp but got an error
error:
[17:50:10] Local gulp not found in ~/workspace/testapp
[17:50:11] Try running: npm install gulp
Tried running npm install gulp (tried sudo as well) but got the following error
error:
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 minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN #angular/compiler-cli#4.0.3 requires a peer of #angular/compiler#4.0.3 but none was installed.
npm WARN #angular/compiler-cli#4.0.3 requires a peer of #angular/core#4.0.3 but none was installed.
npm WARN angular2-universal#2.1.0-rc.1 requires a peer of zone.js#~0.6.21 but none was installed.
npm WARN apollo-server#0.3.3 requires a peer of graphql#^0.6.1 || ^0.7.0 but none was installed.
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2017-07-26T17_52_19_821Z-debug.log
Here is a bit of output from the log file
2238 verbose unlock done using /home/ubuntu/.npm/_locks/staging-719b6a82c67d40a4.lock for /home/ubuntu/workspace/testapp/node_modules/.staging
2239 warn #angular/compiler-cli#4.0.3 requires a peer of #angular/compiler#4.0.3 but none was installed.
2240 warn #angular/compiler-cli#4.0.3 requires a peer of #angular/core#4.0.3 but none was installed.
2241 warn angular2-universal#2.1.0-rc.1 requires a peer of zone.js#~0.6.21 but none was installed.
2242 warn apollo-server#0.3.3 requires a peer of graphql#^0.6.1 || ^0.7.0 but none was installed.
2243 verbose stack TypeError: Cannot read property '0' of undefined
2243 verbose stack at rmStuff (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/lib/unbuild.js:61:24)
2243 verbose stack at tryCatcher (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
2243 verbose stack at ret (eval at makeNodePromisifiedEval (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:13:39)
2243 verbose stack at lifecycle.then.then (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/lib/install/action/unbuild.js:12:12)
2243 verbose stack at tryCatcher (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
2243 verbose stack at Promise._settlePromiseFromHandler (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
2243 verbose stack at Promise._settlePromise (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
2243 verbose stack at Promise._settlePromise0 (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
2243 verbose stack at Promise._settlePromises (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
2243 verbose stack at Async._drainQueue (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
2243 verbose stack at Async._drainQueues (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
2243 verbose stack at Immediate.Async.drainQueues (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
2243 verbose stack at runCallback (timers.js:781:20)
2243 verbose stack at tryOnImmediate (timers.js:743:5)
2243 verbose stack at processImmediate [as _immediateCallback] (timers.js:714:5)
2244 verbose cwd /home/ubuntu/workspace/testapp
2245 verbose Linux 4.9.17-c9
2246 verbose argv "/home/ubuntu/.nvm/versions/node/v8.2.1/bin/node" "/home/ubuntu/.nvm/versions/node/v8.2.1/bin/npm" "install" "gulp"
2247 verbose node v8.2.1
2248 verbose npm v5.3.0
2249 error Cannot read property '0' of undefined
2250 verbose exit [ 1, true ]
Any idea what went wrong?
It is the problem with npm#5.3.0 . Try downgrading the npm by following command and npm install again.
npm install -g npm#5.2.0

Resources