create-react-app failing with error - reactjs

I'm trying to create a new react project with create-react-app but it's failing with the below error
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find any versions for "require-from-string" that matches "^1.1.0"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Received malformed response from registry for "timed-out". The registry may be down.
at MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:139:5)
at C:\Program Files (x86)\Yarn\lib\cli.js:48907:15
at next (native)
at step (C:\Program Files (x86)\Yarn\lib\cli.js:92:30)
at C:\Program Files (x86)\Yarn\lib\cli.js:110:14
at new Promise (C:\Program Files (x86)\Yarn\lib\cli.js:93093:7)
at C:\Program Files (x86)\Yarn\lib\cli.js:89:12
at Function.findVersionInRegistryResponse (C:\Program Files (x86)\Yarn\lib\cli.js:48946:7)
at C:\Program Files (x86)\Yarn\lib\cli.js:48963:28
at next (native)
Aborting installation.

This is a temporary failure in npm registry (source)

Related

yarn - installation of deasync fails

When I create a react app on Windows with node 15 like this:
yarn create react-app my-project --template typescript
It fails with
yarn create v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents#1.2.9: The platform "win32" is incompatible with this module.
info "fsevents#1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents#2.0.6: The platform "win32" is incompatible with this module.
info "fsevents#2.0.6" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/4] ⠁ waiting...
[-/4] ⠁ waiting...
[3/4] ⠂ deasync
error C:\Users\teyc\AppData\Local\Yarn\Data\global\node_modules\deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments:
Directory: C:\Users\teyc\AppData\Local\Yarn\Data\global\node_modules\deasync
Output:
C:\Users\teyc\AppData\Local\Yarn\Data\global\node_modules\deasync>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp#7.1.2
gyp info using node#15.0.1 | win32 | x64
gyp info find Python using Python version 3.7.3 found at "C:\Users\teyc\AppData\Local\Programs\Python\Python37-32\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.8.30717.126) found at:
I don't want to install compilers. Are there binaries available for downloading?
Unfortunately, the deasync node package might not contain every binary for your node version and operating system, and yarn for some inexplicable reason requires it when running create react-app while npx doesn't.
Your options are:
Figure out how to download the prebuilt binaries into your system
https://github.com/abbr/deasync-bin
use npx
npx create react-app my-project --template typescript
use yarn 2. This is the method I prefer as it consumes less disk space
yarn set version berry
yarn create react-app myproject --template typescript

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.

#fontawesome-svg-core Requiring Authentication

I am trying to install Fontawesome 5 in a create-react-app project. I have a Pro license. It won't install #fontawesome-svg-core (or any other #fortawesome module). It says it requires authentication. I have an .npmrc file sitting next to my package.json file. Tried npm and yarn: yarn add #fortawesome/fontawesome-svg-core and npm i --save #fortawesome/fontawesome-svg-core, same results Anyone seen this before?
.npmrc file:
#fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=########-####-####-####-##############
error:
Error: https://npm.fontawesome.com/#fortawesome%2ffontawesome-svg-core: authentication required
at Request.params.callback [as _callback] (C:\Program Files (x86)\Yarn\lib\cli.js:66056:18)
at Request.self.callback (C:\Program Files (x86)\Yarn\lib\cli.js:140665:22)
at Request.emit (events.js:314:20)
at Request.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:141637:10)
at Request.emit (events.js:314:20)
at IncomingMessage.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:141559:12)
at Object.onceWrapper (events.js:420:28)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1252:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
They cut off our access from the authenticated NPM, thinking somehow that this would make us more willing to pay for FA6... go figure...
Anyway.
You can get the fontawesome-svg-core directory and the other free packages from their Github repo https://github.com/FortAwesome/Font-Awesome/tree/master/js-packages/%40fortawesome
You can get the remaining from packages from your download page on the font awesome website: look for the npm packages.
Then you'll need to put that all together somewhere you can import from. Here it is working.

How can I fix react js npx module installation functioning error

when I'm trying to use npx create-react-app MernCrud it not working properly I try to change the prefix path of npm config but its giving the same error and path doesn't change
I tried to install npm then this came
C:\Users\Pumudu Fernando\Desktop\ReactProject>npm install npm WARN
saveError ENOENT: no such file or directory, open 'C:\Users\Pumudu
Fernando\Desktop\ReactProject\package.json' npm notice created a
lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open
'C:\Users\Pumudu Fernando\Desktop\ReactProject\package.json' npm WARN
ReactProject No description npm WARN ReactProject No repository field.
npm WARN ReactProject No README data npm WARN ReactProject No license
field.
when try to npx create-react-app MernCrud
C:\Users\Pumudu Fernando\Desktop\ReactProject>nox create-react-app
CrudMern 'nox' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Pumudu Fernando\Desktop\ReactProject>npx create-react-app
CrudMern Error: EPERM: operation not permitted, mkdir
'C:\Users\Pumudu' TypeError: Cannot read property 'get' of undefined
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:78:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:228:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20)
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program
Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205 if
(npm.config.get('json')) {
^
TypeError: Cannot read property 'get' of undefined
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at process.emit (events.js:189:13)
at process._fatalException (internal/bootstrap/node.js:496:27) Install for create-react-app#latest failed with code 7
It should create the project but that won't happen npm start also not working
Finally i found the answer so i clear the cache npm cache clean --force
then i change the prefix path of config edit to
C:\Users\\AppData\Roaming\npm
then i gave the command to administrator cmd
npm config set cache C:\tmp\nodejs\npm-cache --global after that
npx create-react-app name work properly

Yeoman angular app npm install error not working

I've searched far and wide for a solution to this but can't seem to find an answer. I've used Yeoman scaffolding many times before on my old Windows 8 PC but I can't get it working on my new Windows 8 PC.
I'm trying to scaffold an angular app using Yeoman. I did the following:
> npm install --global npm
> npm install --global yo bower grunt-cli
> npm install --global generator-angular
> mkdir mytodo && cd mytodo
> npm --version && yo --version && bower --version && grunt --version
2.5.1
1.4.6
1.4.1
grunt-cli v0.1.13
grunt v0.4.5
> yo angular
It runs up to the point where it runs bower install & npm install then shows a whole heap of errors. This is in the npm-debug.log file.
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#2.5.1
3 info using node#v0.12.1
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose config Skipping project config: C:\Users\melon/.npmrc. (matches userconfig)
6 error install Couldn't read dependencies
7 verbose stack Error: ENOENT, open 'C:\Users\melon\package.json'
7 verbose stack at Error (native)
8 verbose cwd C:\Users\melon
9 error Windows_NT 6.2.9200
10 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
11 error node v0.12.1
12 error npm v2.5.1
13 error path C:\Users\melon\package.json
14 error code ENOPACKAGEJSON
15 error errno -4058
16 error package.json ENOENT, open 'C:\Users\melon\package.json'
16 error package.json This is most likely not a problem with npm itself.
16 error package.json npm can't find a package.json file in your current directory.
17 verbose exit [ -4058, true ]
What I find interesting in the errors is that it is referring to "C:\Users\melon\package.json". Shouldn't it be looking in the project folder for package.json (which is c:\projects\mytodo)?
Another weird thing is that it is putting a folder called node_modules inside C:\Users\melon\node_modules. This folder contains grunt, grunt-karma, jasmine-core, karma and karma-jasmine. I already have the node_modules folder in C:\Users\melon\AppData\Roaming\npm\node_modules\
If I run the following manually, it installs successfully.
> bower install
If I run the following manually, it fails.
> npm install
gifsicle#2.0.1 postinstall C:\Projects\mytodo\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
> node lib/install.js
module.js:338
throw err;
^
Error: Cannot find module 'C:\Users\melon\lib\install.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
...........
Here is some relevant PATH details:
PATH=C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Ruby193\bin;C:\ant\bin;C:\Users\melon\AppData\Roaming\npm
I hope this is enough information for someone to show me where I have gone wrong. Thanks in advance.
Since I can not comment yet (need 50 rep.), I'm posting this as an answer.
Run Node.js as admin. This often helps a lot with those kind of errors.
Your PATH variable is correct (Ruby is there, so is Git).
I suggest you try npm install -g bower first because there seems to be something wrong with the package.
Have you already tried another generator (e.g. webapp)?

Resources