Error installing create react app with code 7 - create-react-app

This type of error creeps up when I am trying to install create react app with command line .How can I fix this problem ?
C:\Users\Rohit Mishra>npx create-react-app my-app
Error: EPERM: operation not permitted, mkdir 'C:\Users\Rohit'
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
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)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Install for create-react-app#latest failed with code 7

The issue is occurring because you have space between your computer username.
You can resolve this by not installing your create-react-app package globally.
Use these commands :-
1. npm cache clean --force
2. npm install create-react-app --force
3. npm fund
4. npx create-react-app <app-name>

Related

After running yarn, get fsevents command failed after Mac book update

After MacBook updated to v12.4 when I try to run yarn command on my react native project I get this error:
error /Users/jaugustinus/Documents/Dev/Service-Bay/node_modules/fsevents: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /Users/jaugustinus/Documents/Dev/Service-Bay/node_modules/fsevents
Output:
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn node-gyp ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn node-gyp',
path: 'node-gyp',
This command was running fine yesterday and the only change would be Mac OS update.
Tried also running
rm -rf node_modules
yarn cache clean
yarn
and still got the same error
The error I got was when using node version 16.15.0
If I change the node version to 17.8.0 then I am able to run yarn with no issues.

NPM install and upgrade throws Couldn't find package error when used in monorepo

Recently my shared monorepo package is not being resolved properly is is being treated as npm package not a monorepo package causing an error.
$ yarn install
yarn install v1.19.1
[1/4] Resolving packages...
error Couldn't find package "#placeholderName/common#^1.0.307" required by "#placeholderName/browser#1.0.307" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "#placeholderName/common#^1.0.307" required by "#placeholderName/server#1.0.307" on the "npm" registry.
at MessageError.ExtendableBuiltin (C:\Program Files (x86)\Yarn\lib\cli.js:721:66)
at new MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:750:123)
at PackageRequest.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:36539:17)
at Generator.throw (<anonymous>)
at step (C:\Program Files (x86)\Yarn\lib\cli.js:304:30)
at C:\Program Files (x86)\Yarn\lib\cli.js:317:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Im unsure of how to get rid of this annoying error and I've been trying for a while

Why "Cannot find module 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt'", but it's there?

This is driving me nuts!
I have an NPM module that I successfully build in my Jenkins pipeline in a Windows node. Then later on in my pipeline, I execute another task, and get Cannot find module 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt'. So for the hell of it I try to install grunt-cli and grunt again before I execute my task and see this.
00:10:42.733 + npm install -g grunt-cli
00:10:49.273 npm ERR! code EEXIST
00:10:49.273 npm ERR! path C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt
00:10:49.273 npm ERR! dest C:\Program Files\nodejs\grunt
00:10:49.273 npm ERR! EEXIST: file already exists, cmd shim 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt' -> 'C:\Program Files\nodejs\grunt'
00:10:49.273 npm ERR! File exists: C:\Program Files\nodejs\grunt
00:10:49.273 npm ERR! Remove the existing file and try again, or run npm
00:10:49.273 npm ERR! with --force to overwrite files recklessly.
00:10:49.273
00:10:49.273 npm ERR! A complete log of this run can be found in:
00:10:49.273 npm ERR! C:\Users\vagrant\AppData\Roaming\npm-cache\_logs\2022-03-09T03_53_47_072Z-debug.log
00:10:49.279 [Pipeline] echo
00:10:49.280 WARNING: grunt-cli is already installed!
00:10:49.283 [Pipeline] sh
00:10:49.555 + grunt print-artifact-name -q
00:10:49.556 internal/modules/cjs/loader.js:883
00:10:49.556 throw err;
00:10:49.556 ^
00:10:49.556
00:10:49.556 Error: Cannot find module 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt'
00:10:49.556 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
00:10:49.556 at Function.Module._load (internal/modules/cjs/loader.js:725:27)
00:10:49.556 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
00:10:49.556 at internal/main/run_main_module.js:17:47 {
00:10:49.556 code: 'MODULE_NOT_FOUND',
00:10:49.556 requireStack: []
00:10:49.556 }
What's going on? How can I solve this?

Failed installing Nuxt.js

Hi I'm trying to create a Nuxt project using npx and this is what I get:
$ npx create-nuxt-app nuxt-prop
Error: EPERM: operation not permitted, mkdir 'C:\Users\Faturachman'
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
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)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Install for create-nuxt-app#latest failed with code 7
Can anyone help me what's wrong? I can't seem to find the solution anywhere :/
the problem would be seem because of spacing in the username, so i managed to fix it by running cmd as administrator and
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global
change the spacing with "~1"

Issue Installing Polymer on Arch Linux via npm

I get the following error when installing Polymer CLI as follows
sudo npm install -g polymer-cli
29577 info lifecycle wd#1.5.0~install: wd#1.5.0
29578 verbose lifecycle wd#1.5.0~install: unsafe-perm in lifecycle false
29579 verbose lifecycle wd#1.5.0~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/lib/node_modules/polymer-cli/node_modules/wd/node_modules/.bin:/usr/lib/node_modules/polymer-cli/node_modules/.bin:/usr/lib/node_modules/.bin:/usr/local/sbin:/usr/loc\
al/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
29580 verbose lifecycle wd#1.5.0~install: CWD: /usr/lib/node_modules/polymer-cli/node_modules/wd
29581 silly lifecycle wd#1.5.0~install: Args: [ '-c', 'node scripts/build-browser-scripts' ]
29582 silly lifecycle wd#1.5.0~install: Returned: code: 1 signal: null
29583 info lifecycle wd#1.5.0~install: Failed to exec install script
29584 verbose unlock done using /root/.npm/_locks/staging-a072192f34a17023.lock for /usr/lib/node_modules/.staging
29585 verbose stack Error: wd#1.5.0 install: `node scripts/build-browser-scripts`
29585 verbose stack Exit status 1
29585 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
29585 verbose stack at EventEmitter.emit (events.js:160:13)
29585 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
29585 verbose stack at ChildProcess.emit (events.js:160:13)
29585 verbose stack at maybeClose (internal/child_process.js:943:16)
29585 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
29586 verbose pkgid wd#1.5.0
Any idea how to fix it?
UPDATE
I updated the npm and bower to the latest versions and then ran the install command again for polymer-cli. Now I get the following error message - it's a permissioning problem when running the script. I am not sure if this is down to the npm install script or if it is an arch linux problem.
sudo npm install -g polymer-cli
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated github#7.3.2: 'github' has been renamed to '#octokit/rest' (https://git.io/vNB11)
npm WARN deprecated #types/assert#0.0.29: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
/usr/bin/polymer -> /usr/lib/node_modules/polymer-cli/bin/polymer.js
> uws#0.14.5 install /usr/lib/node_modules/polymer-cli/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
sh: build_log.txt: Permission denied
> wd#1.5.0 install /usr/lib/node_modules/polymer-cli/node_modules/wd
> node scripts/build-browser-scripts
/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
at Object.fs.mkdirSync (fs.js:905:18)
at sync (/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
at Object.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:193:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd#1.5.0 install: `node scripts/build-browser-scripts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd#1.5.0 install 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! /root/.npm/_logs/2018-01-28T19_51_38_197Z-debug.log
The issue now is when the script tries to make this directory:
mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
use --unsafe-perm option to install polymer-cli globally as described here
sudo npm install -g polymer-cli --unsafe-perm
or Change npm's Default Directory
and then install npm install -g polymer-cli without sudo and --unsafe-perm option.
Switched to Yarn and it installs!
sudo yarn global add polymer-cli
yarn global v1.3.2
[1/4] Resolving packages...
warning polymer-cli > babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
warning polymer-cli > bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
warning polymer-cli > github#7.3.2: 'github' has been renamed to '#octokit/rest' (https://git.io/vNB11)
warning polymer-cli > polyserve > #types/assert#0.0.29: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "polymer-cli#1.5.7" with binaries:
- polymer
Done in 61.35s.