react-native start faild, npm start faild. project is not run - npm

react-native run-android . server is faild, I don't know how to solve it. hope someone can help me。
react-native start faild .
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node#5/5.12.0/bin/node"
"/usr/local/bin/npm" "start"
npm ERR! node v5.12.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! 1#1.1.1 start: `node node_modules/react-native/local-
cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 1#1.1.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 1 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 1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls 1
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/apple/Desktop/project/reactproject/IRunning/npm-debug.log
.
Last login: Fri Jan 13 09:45:42 on ttys000
AppledeMacBook-Pro:~ apple$
/Users/apple/Desktop/project/reactproject/IRunning/node_modules/
.0.36.0#react-native/packager/launchPackager.command ; exit;
~/Desktop/project/reactproject/IRunning/node_modules/.0.36.0#react-
native/packager ~
Scanning 1631 folders for symlinks in /Users/apple/Desktop/project/reactproject/IRunning/node_modules (30ms)
┌──────────────────────────────────────────────────────────────────────── ────┐
│ 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
Cannot read property 'on' of undefined
~
Process terminated. Press <enter> to close the window

Looks like you have to reinstall or update node.js and npm. Try to follow instalation steps on this page once more:
https://facebook.github.io/react-native/docs/getting-started.html#content
Also make sure you are following instructions for correct system you are using

Related

Failed to install react-native-web#~0.18.7, react-dom with error: npm exited with non-zero code: 1 npm exited with non-zero code: 1

I am trying to start a expo project on web but it throws this error, Can anyone help me please?
Press a │ open Android
› Press w │ open web
› Press r │ reload app
› Press m │ toggle menu
› Press ? │ show all commands
Logs for your project will appear below. Press Ctrl+C to exit.
Started Metro Bundler
√ It looks like you're trying to use web support but don't have the required dependencies installed. Would you like to install
react-native-web, react-dom? ... yes
× Failed to install react-native-web#~0.18.7, react-dom with error: npm exited with non-zero code: 1
npm exited with non-zero code: 1
?
› Stopped server
C:\Users\Human\News-Application>expo start
This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo start
Starting project at C:\Users\Human\News-Application
"react-native-web" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.
C:\Users\Human\News-Application>npm install react-native-web
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: news-application#1.0.0
npm ERR! Found: react#18.1.0
npm ERR! node_modules/react
npm ERR! react#"18.1.0" from the root project
npm ERR! peer react#"^17.0.2 || ^18.0.0" from react-native-web#0.18.12
npm ERR! node_modules/react-native-web
npm ERR! react-native-web#"~0.18.7" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"^17.0.2 || ^18.0.0" from react-native-web#0.18.12
npm ERR! node_modules/react-native-web
npm ERR! react-native-web#"~0.18.7" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\Human\AppData\Local\npm-cache_logs\2023-02-10T03_04_04_748Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Human\AppData\Local\npm-cache_logs\2023-02-10T03_04_04_748Z-debug-0.log
I tried insalling react-native-web with npm install and I was expecting smooth installation but it says Failed to install react-native-web#~0.18.7 with error: npm exited with non-zero code: 1
I resolved this issue by doing a force install as the console messages were suggesting and then using expo doctor (again as the console messages were suggestion) to fix the dependency issue.
npm install react-native-web, react-dom --force
and once the installation is done, do:
expo doctor --fix-dependencies
My app runs successfully afterwards.

Error when running 'npm install' and 'npm start'

I ran npm install in my project directory.
But I get this error while running npm install:
D:\Personal\██████████████████████████████████████████████████████████████\rn-starter-main>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.0" from #react-native-community/masked-view#0.1.10
npm ERR! node_modules/#react-native-community/masked-view
npm ERR! #react-native-community/masked-view#"0.1.10" 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 C:\Users\███████\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\███████\AppData\Local\npm-cache\_logs\2022-04-02T02_39_48_352Z-debug-0.log```
npm install --force installed the packages, but when I run npm start, I get the following error:
D:\Personal\████████████████████████████████████████████████████████\rn-starter-main>npm start
> start
> expo start
┌─────────────────────────────────────────────────────────────────────────┐
│ │
│ There is a new version of expo-cli available (5.3.0). │
│ You are currently using expo-cli 5.1.1 │
│ Install expo-cli globally using the package manager of your choice; │
│ for example: `npm install -g expo-cli` to get the latest version │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Starting project at D:\Personal\███████████████████████████████████\rn-starter-main
Unable to find expo in this project - have you run yarn / npm install yet?
For the conflicting peer dependency error, I tried:
npm install --legacy-peer-deps and
npm install --force
But none of them seems to have worked. This error is still persisting.
For the expo not found error, I tried commands like:
npm cache clean,
expo install,
expo update,
npm add expo
expo rebuild etc.
I thought this error might be due to older expo versions like 36 and 37 that I've worked with, so, I uninstalled all of Node and NPM and downloaded them again from https://nodejs.org/en/ , but I still get the same "conflicting peer dependency" and "Unable to find expo" errors. Could you please help me with this? Thank you.
Running the command npm install -g expo-cli fixes both the errors. These errors are just due to npm not being installed globally.

Local package.json exists, but node_modules missing, did you mean to install?

I am trying to clone and use pix/pix in my laptop for a university project
(https://github.com/1024pix/pix). But I am getting the following error:
H:\Bachelor YGREC - Modelling & Data Science\Bachelor Year 1\Project\Project 2\pix>npm run configure
> pix#2.116.0 configure H:\Bachelor YGREC - Modelling & Data Science\Bachelor Year 1\Project\Project 2\pix
> npm install && run-s ci:all test configure:api
> pix#2.116.0 preinstall H:\Bachelor YGREC - Modelling & Data Science\Bachelor Year 1\Project\Project 2\pix
> test "$(npm --version)" = 6.13.4
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pix#2.116.0 preinstall: `test "$(npm --version)" = 6.13.4`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pix#2.116.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-02-24T10_36_42_126Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pix#2.116.0 configure: `npm install && run-s ci:all test configure:api`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pix#2.116.0 configure script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-02-24T10_36_42_183Z-debug.log
You should have found the answer by now but if someone else find it useful, just run npm install in your console.
Write npm start in the terminal followed by npm install. This will solve your issue.

How to change location of index.js

I'm trying to re arrange a project repo from this:
public/
src/
|
|---- index.js
package.json
To this:
public/
frontend/
|
|---- src/
|
|---- index.js
package.json
When I rearranged, npm start would fail with this message:
Could not find a required file.
Name: index.js
Searched in: /Users/sahandzarrinkoub/Documents/Programming/DH2642/Sentify/repo/Sentify/Sentify/src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Sentify#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Sentify#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
So I went into the package.json file and added this:
"main": "frontend/src/index.js",
What's strange is that nothing changes. npm tells me that it's still looking in the same directory for index.js.
Could not find a required file.
Name: index.js
Searched in: /Users/sahandzarrinkoub/Documents/Programming/DH2642/Sentify/repo/Sentify/Sentify/src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sentify#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sentify#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
How can I successfully rearrange my project into this organisation? How can I tell npm where to look for index.js?
I also tried:
"main": "/Users/sahandzarrinkoub/Documents/Programming/DH2642/Sentify/repo/Sentify/Sentify/frontend/src/index.js",

Error installing Dalek JS Module - Chrome Browser

I'm having trouble installing the Chrome Browser Dalek JS Module.
Here's an extract from the console output:
npm http 304 https://registry.npmjs.org/abbrev
> dalek-browser-chrome#0.0.2 install /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome
> node install.js
Chromedriver installation failed Error: EACCES, permission denied '/Users/xxx/tmp/chromedriver'
at Object.fs.unlinkSync (fs.js:582:18)
at rimrafSync (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/rimraf/rimraf.js:154:8)
at Promise._successFn (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/install.js:176:7)
at Promise._withInput (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:204:25)
at Promise._chainPromise (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:244:13)
at Promise.then (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:144:13)
at /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/install.js:175:23
at loadCbs.length (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/npmconf/npmconf.js:76:7)
at Array.forEach (native)
at /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/npmconf/npmconf.js:75:13
npm ERR! dalek-browser-chrome#0.0.2 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR!
npm ERR! Failed at the dalek-browser-chrome#0.0.2 install script.
npm ERR! This is most likely a problem with the dalek-browser-chrome package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls dalek-browser-chrome
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dalek-browser-chrome" "--save-dev"
npm ERR! cwd /Users/xxx/Sites/tests
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/xxx/Sites/tests/npm-debug.log
npm ERR! not ok code 0
i'm running Mac OS X 10.8.4. it looks like a permissions issue, but i'm running the install as follows:
sudo npm install dalek-browser-chrome --save-dev
UPDATE
I did try running this without sudo first - but got the following:
── ncp#0.4.2
├── kew#0.1.7
├── q#0.9.6
├── adm-zip#0.4.3
├── rimraf#2.2.2 (graceful-fs#2.0.0)
└── npmconf#0.1.2 (once#1.1.1, inherits#2.0.1, osenv#0.0.3, ini#1.1.0, mkdirp#0.3.5, semver#2.1.0, nopt#2.1.2, config-chain#1.1.7)
npm ERR! Error: EACCES, open '/Users/xxx/Sites/tests/package.json'
npm ERR! { [Error: EACCES, open '/Users/xxx/Sites/tests/package.json']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/Sites/tests/package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dalek-browser-chrome" "--save-dev"
npm ERR! cwd /Users/xxx/Sites/tests
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! path /Users/xxx/Sites/tests/package.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/xxx/Sites/tests/package.json'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/xxx/Sites/tests/npm-debug.log
npm ERR! not ok code 0
Based on this I tried it with Sudo.
Any idea what else it might be?
The chromedriver module is attempting to run an install script that touches files outside of the module's directory.
This is a bug with the chromedriver module. It should not be trying to touch any files outside of its module folder at install time. If this is absolutely necessary, it can ask for permission from you at run time and do what it needs to do.
In order to prevent surprising exploits, npm runs package lifecycle scripts as nobody when you are running npm as root. The nobody user doesn't have permission to write to /Users/xxx/tmp (weird username you've chosen, btw), so the install script fails.
What if a package were to write to /etc/hosts or something, and add a bunch of phishing site IP addresses as the location for various bank websites? If you download a command, and then run it, and it does some bad stuff, ok, you screwed up and trusted the wrong program. But if simply installing the program does some bad stuff like this, then npm has violated your trust, and I try not to let that happen.
You could argue that you've explicitly asked to download the program, but since the web of trust with small dependencies can get very wide, it's just a bit too dangerous for me to sleep well at night, so that's why npm has this rule.
The problem could be related with the use of sudo,
the module is a local one, so you should be able to install it without the use of sudo.
After the chromedriver executable is downloaded, the installer tries to fix the permissions of the downloaded file, which might result in this problem.
Further read on to sudo or not: http://howtonode.org/introduction-to-npm