I'm a beginner to react.js, and are just starting to learn the ropes
i want to create a react app and start it in localhost:3000,
after creating the app, npm start doesn't do anything or give any results
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\User\Desktop\myreactfolder> npx create-react-app my-app
npx: installed 98 in 25.077s
Creating a new React app in C:\Users\User\Desktop\myreactfolder\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
+ cra-template#1.0.3
+ react#16.13.1
+ react-dom#16.13.1
+ react-scripts#3.4.1
added 1626 packages from 752 contributors and audited 1630 packages in 221.272s
59 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
Initialized a git repository.
Installing template dependencies using npm...
npm WARN tsutils#3.17.1 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
+ #testing-library/jest-dom#4.2.4
+ #testing-library/react#9.5.0
+ #testing-library/user-event#7.2.1
added 36 packages from 56 contributors and audited 1666 packages in 23.169s
59 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
Removing template package using npm...
npm WARN tsutils#3.17.1 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
removed 1 package and audited 1665 packages in 9s
59 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
Created git commit.
Success! Created my-app at C:\Users\User\Desktop\myreactfolder\my-app
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd my-app
npm start
Happy hacking!
PS C:\Users\User\Desktop\myreactfolder> cd my-app
PS C:\Users\User\Desktop\myreactfolder\my-app> npm start
PS C:\Users\User\Desktop\myreactfolder\my-app>
1.Go to the package.json in my-app.
2.In the scripts object, check if there exists a start command
3.Your scripts object should look something like this
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
Match your scripts object with this and then try npm start, it should work fine.
Related
As of recently, I've started getting warnings when creating a new react app. This happened without me personally doing anything, it just started happening. I copied and pasted all the messages below - as you can see, it catches some exceptions and tells me I need to install dependencies myself.
My questions are
Why is this happening? Again, it just started happening one day without me doing anything.
Is there a way I can get back to where I could just install a react app and none of these warnings come up? Or from here on out, do I need to install these dependencies myself? If so, I wouldn't know how to go about doing that and would appreciate some guidance.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
> core-js#2.6.12 postinstall C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js#3.18.0 postinstall C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure#3.18.0 postinstall C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
> ejs#2.7.4 postinstall C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing\node_modules\ejs
> node ./postinstall.js
+ react-scripts#4.0.3
+ cra-template#1.1.2
+ react#17.0.2
+ react-dom#17.0.2
added 1909 packages from 708 contributors and audited 1912 packages in 94.802s
149 packages are looking for funding
run `npm fund` for details
found 3 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
Initialized a git repository.
Installing template dependencies using npm...
npm WARN #babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining#7.15.4 requires a peer of #babel/core#^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.21.0 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ web-vitals#1.1.2
+ #testing-library/jest-dom#5.14.1
+ #testing-library/react#11.2.7
+ #testing-library/user-event#12.8.3
added 43 packages from 86 contributors and audited 1955 packages in 22.719s
150 packages are looking for funding
run `npm fund` for details
found 3 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
Removing template package using npm...
npm WARN #babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining#7.15.4 requires a peer of #babel/core#^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.21.0 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
removed 1 package and audited 1954 packages in 11.143s
150 packages are looking for funding
run `npm fund` for details
found 3 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
at checkExecSyncError (child_process.js:760:11)
at execSync (child_process.js:833:15)
at tryGitCommit (C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing\node_modules\react-scripts\scripts\init.js:62:5)
at module.exports (C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing\node_modules\react-scripts\scripts\init.js:352:25)
at [eval]:3:14
at Script.runInThisContext (vm.js:134:12)
at Object.runInThisContext (vm.js:310:38)
at internal/process/execution.js:81:19
at [eval]-wrapper:6:22
at evalScript (internal/process/execution.js:80:60) {
status: 128,
signal: null,
output: [ null, null, null ],
pid: 25692,
stdout: null,
stderr: null
}
Removing .git directory...
Success! Created testing at C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\testing
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd testing
npm start
Happy hacking!
I followed the instructions on the material ui website about how to install it. I had a successful installation, but the installation generated several warnings all starting with "npm WARN" and telling me I have to install peer dependencies myself. I'm hoping someone can let me know 1) what is the cause of this issue and 2) how to install the peer dependencies (assuming that's the solution).
Here's everything the terminal displayed after I ran the command to install material-ui
PS C:\Users\Benjamin\PROGRAMMING_PROJECTS\REACT_PROJECTS\tutorial_material_ui> npm install #mui/material #emotion/react #emotion/styled
npm WARN #babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining#7.15.4 requires a peer of #babel/core#^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.21.0 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ #emotion/react#11.4.1
+ #emotion/styled#11.3.0
+ #mui/material#5.0.0
added 36 packages from 46 contributors and audited 1988 packages in 31.331s
155 packages are looking for funding
run `npm fund` for details
found 3 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
When I am trying to initialize a react project it is giving me vulnerabilities and the project is not running.
E:\react_projects>npx create-react-app testapp-1
npx: installed 67 in 8.639s
Creating a new React app in E:\react_projects\testapp-1.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
> core-js#2.6.12 postinstall E:\react_projects\testapp-1\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js#3.13.0 postinstall E:\react_projects\testapp-1\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure#3.13.0 postinstall E:\react_projects\testapp-1\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
> ejs#2.7.4 postinstall E:\react_projects\testapp-1\node_modules\ejs
> node ./postinstall.js
+ cra-template#1.1.2
+ react-dom#17.0.2
+ react-scripts#4.0.3
+ react#17.0.2
added 1907 packages from 706 contributors and audited 1910 packages in 206.323s
138 packages are looking for funding
run `npm fund` for details
found 81 vulnerabilities (80 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
Initialized a git repository.
Installing template dependencies using npm...
npm WARN #babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining#7.13.12 requires a peer of #babel/core#^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.21.0 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ #testing-library/jest-dom#5.12.0
+ #testing-library/react#11.2.7
+ web-vitals#1.1.2
+ #testing-library/user-event#12.8.3
added 29 packages from 78 contributors and audited 1939 packages in 12.653s
138 packages are looking for funding
run `npm fund` for details
found 81 vulnerabilities (80 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removing template package using npm...
npm WARN #babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining#7.13.12 requires a peer of #babel/core#^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.21.0 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
removed 1 package and audited 1938 packages in 8.97s
138 packages are looking for funding
run `npm fund` for details
found 81 vulnerabilities (80 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
Created git commit.
Success! Created testapp-1 at E:\react_projects\testapp-1
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd testapp-1
npm start
Happy hacking!
E:\react_projects>apm start
'apm' is not recognized as an internal or external command,
operable program or batch file.
E:\react_projects>npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path E:\react_projects\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'E:\react_projects\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Daksh\AppData\Roaming\npm-cache\_logs\2021-05-26T05_38_36_900Z-debug.log
E:\react_projects>npm audit
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Daksh\AppData\Roaming\npm-cache\_logs\2021-05-26T05_39_01_624Z-debug.log
Looks like you are not in your project directory. Your project is inside the testapp-1 folder and only inside this will you find the package.json. So open a terminal from testapp-1 folder and then run npm start.
I am trying to use the ipfs package inside my react app but it won't recognize the module when I run.
sudo npm start
I install the module with
sudo npm install -g --unsafe-perm ipfs-http-client
This installs with the following output
> iso-constants#0.1.2 install /home/a/Documents/c/d1/dapp1/Dapp/client/node_modules/iso-constants
> node build.js > index.browser.js
> secp256k1#4.0.2 install /home/a/Documents/c/d1/dapp1/Dapp/client/node_modules/libp2p-crypto/node_modules/secp256k1
> node-gyp-build || exit 0
> ursa-optional#0.10.2 install /home/a/Documents/c/d1/dapp1/Dapp/client/node_modules/ursa-optional
> node rebuild.js
> protobufjs#6.10.2 postinstall /home/a/Documents/c/d1/dapp1/Dapp/client/node_modules/protobufjs
> node scripts/postinstall
npm WARN bootstrap#4.5.0 requires a peer of jquery#1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap#4.5.0 requires a peer of popper.js#^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.17.1 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/babel/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ ipfs-http-client#49.0.4
added 137 packages from 293 contributors, removed 64 packages, updated 15 packages, moved 8 packages and audited 2367 packages in 118.569s
This is the error I get
./src/components/ipfs/fileUpload.js
Module not found: Can't resolve 'ipfs-api' in '/home/a/Documents/c/d1/dapp1/Dapp/client/src/components/ipfs'
This is the component
import React, { Component, useEffect, useState } from "react";
const ipfsAPI = require('ipfs-api')
// connect to the default API address http://localhost:5001
const UploadImage = () => {
const [request, setRequest] = useState({});
const ipfs = ipfsAPI
const handleSubmit = async (data) => {
const { cid } = await ipfs.add(data)
}
return (
<div>
<form method="post" onSubmit={handleSubmit} enctype="multipart/form-data">
<div>
<label for="profile_pic">Choose file to upload</label>
<input type="file" id="profile_pic" name="profile_pic"
accept=".jpg, .jpeg">
</input>
</div>
<div>
<button>Submit</button>
</div>
</form>
</div>
)
}
export default UploadImage;
I am using node version v14.16.1 and npm version 6.14.12
I have also installed it globally with -g and it also installs successfully but I get the same error when I run sudo npm start.
include a specific version of the ipfs package,
like
npm i ipfs-http-client#33.0.1
I solved it doing this
npm i ipfs-http-client#50.1.2 #babel/core --save
While installing npm install #apollo/react-hooks, I got the following error message. It tells me about installing graphql with a version higher than 14.3.1, but I have 15.0 installed.
npm WARN #apollo/react-common#3.1.4 requires a peer of graphql#^14.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN #apollo/react-components#3.1.5 requires a peer of graphql#^14.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN #apollo/react-hoc#3.1.5 requires a peer of graphql#^14.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN graphql-tag#2.10.3 requires a peer of graphql#^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You
must install peer dependencies yourself.
npm WARN react-apollo#3.1.5 requires a peer of graphql#^14.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.17.1 requires a peer of 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 but none is installed. You must install peer dependencies yourself.
npm WARN #apollo/react-hooks#3.1.5 requires a peer of graphql#^14.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
>= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN #apollo/react-hooks#3.1.5 requires a peer of graphql#^14.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
32","arch":"x64"})
From the official github repo it seems like you need to install the following peer dependencies & also graphql should be < 15.0.0 since ^ means minor release i.e >= 14.5.8 and < 15.0.0
So do this npm install graphql#14.6.0
run this command
npm uninstall grapql
then
npm install graphql