An unexpected error occurred: "EPERM: operation not permitted" - node.js

I have installed ReactJS to work on some project but this mistakes are making me sick.
First error appear when I tried to add package for my project.
So , I used :
yarn add #material-ui/icons
and after that It was fetching.
And I got this error message on the terminal line :
error An unexpected error occurred: "EPERM: operation not permitted, unlink 'C:\\React\\MyProject\\node_modules\\node-sass\\vendor\\win32-x64-93\\bindiinfo Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
I found some solutions and wanted to try. Whenever I try to use install command, it does not let me.
It gives this error
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XXXXXX\AppData\Roaming\npm-cache\_logs\2021-11-14T00_08_12_781Z-debug.log
enter code here
and whenever I click this error log, here is what I see.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\XXXXXXXX\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'yarn'
1 verbose cli ]
2 info using npm#5.3.0
3 info using node#v16.13.0
4 verbose npm-session 95556b4f7a104717
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/yarn 188ms
8 http fetch GET 200 https://registry.npmjs.org/yarn/-/yarn-1.22.17.tgz 120ms
9 silly pacote tag manifest for yarn#latest fetched in 352ms
10 verbose stack TypeError: cb.apply is not a function
10 verbose stack at C:\Users\XXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
10 verbose stack at FSReqCallback.oncomplete (node:fs:199:5)
11 verbose cwd D:\React\projem
12 verbose Windows_NT 10.0.19043
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\XXXXXXXX\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "yarn"
14 verbose node v16.13.0
15 verbose npm v5.3.0
16 error cb.apply is not a function
17 verbose exit [ 1, true ]
Please help me or I'll drive crazy so soon!
All the best everyone and THANK YOU! for your help.

Please stop the development server and install or add the packages.

I faced same issue when I tried to install the blueprint package using yarn, I solved it by using npm package manager (npm install)

Related

I can't install react using npx create-react-app is this aNodist the issue?

I've received the following in the debug log. I'm looking to npx create-react-app. The terminal is returning
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache_logs\2022-06-07T14_57_21_064Z-debug.log
Install for [ 'create-react-app#latest' ] failed with code 1
This is the debug file...
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files (x86)\\Nodist\\v-x64\\18.1.0\\node.exe',
1 verbose cli 'C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\npx\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-react-app#latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli 'C:\\Users\\User\\AppData\\Roaming\\npm-cache\\_npx\\50292',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm#5.1.0
3 info using node#v18.1.0
4 verbose npm-session 56a59e1a77678c6d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/create-react-app 102ms (from cache)
8 silly pacote tag manifest for create-react-app#latest fetched in 165ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack at C:\Program Files (x86)\Nodist\bin\node_modules\npx\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
9 verbose stack at FSReqCallback.oncomplete (node:fs:204:5)
10 verbose cwd C:\Users\User\Websites\react
11 verbose Windows_NT 10.0.19044
12 verbose argv "C:\\Program Files (x86)\\Nodist\\v-x64\\18.1.0\\node.exe" "C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\npx\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-react-app#latest" "--global" "--prefix" "C:\\Users\\User\\AppData\\Roaming\\npm-cache\\_npx\\50292" "--loglevel" "error" "--json"
13 verbose node v18.1.0
14 verbose npm v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]
I'm using the latest beta version of Node, so I'll try to go back to the latest stable version. If that doesn't work, I'll try to re-download node away from nodist..
If you have any other thoughts or suggestions Perhaps there is a hint in the debug log, then I'd be glad to hear them.
According to the discussion under github https://github.com/facebook/create-react-app/discussions/10173#discussioncomment-142156
you need to
npm rm -g create-react-app
npm install create-react-app
npx create-react-app my-app
After deleting the Nodist version manager. I installed nvm and I'm now able to get npx to work without a problem. I think the issue for me was that I was using the nodist version manager.
Highly recommend checking out nvm here if you get similar issues.
https://github.com/coreybutler/nvm-windows/wiki

React JS: Having issue with CREATE_REACT_APP when using npx command in VS Code

Firstly, I am new to using npm AND react JS and the like so be gentle lol. I am having a great deal of trouble creating a new react application using the npm CLI in Visual Studio Code. The error log text is below in full:
0 info it worked if it ends with ok
1 verbose cli [
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',
1 verbose cli 'create-react-app#latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli 'C:\\Users\\xxxx\\AppData\\Roaming\\npm-cache\\_npx\\7488',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm#6.14.6
3 info using node#v12.18.3
4 verbose npm-session aeaef96635f9906e
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 404 https://github.com/npm/npm-registry-couchapp/create-react-app 458ms
8 http fetch GET 404 https://github.com/npm/npm-registry-couchapp/create-react-app 177ms
9 silly fetchPackageMetaData error for create-react-app#latest 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
10 timing stage:rollbackFailedOptional Completed in 1ms
11 timing stage:runTopLevelLifecycles Completed in 804ms
12 verbose stack Error: 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
12 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:114:15
12 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
13 verbose statusCode 404
14 verbose pkgid create-react-app#latest
15 verbose cwd C:\Users\xxxx\Documents\Development\Courses\JavaScript\react_todo
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-react-app#latest" "--global" "--prefix" "C:\\Users\\xxxx\\AppData\\Roaming\\npm-cache\\_npx\\7488" "--loglevel" "error" "--json"
18 verbose node v12.18.3
19 verbose npm v6.14.6
20 error code E404
21 error 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
22 error 404
23 error 404 'create-react-app#latest' is not in the npm registry.
24 error 404 You should bug the author to publish it (or use the name yourself!)
25 error 404 Note that you can also install from a
26 error 404 tarball, folder, http url, or git url.
27 verbose exit [ 1, true ]
Obviously I can see that the github path it is trying to reach with the GET request does not exist and I have looked on quite a number of sites for this issue and everything I have tried so far has failed to fix the issue.
I have tried: npm uninstall -g followed by npm install -g create-react-app
I have tried clearing the npm cache using npm cache clean --force
Basically I am at loss and would truly greatly appreciate any guidance offered.
Thanks in advance!
Dan
EDIT: The below is the text i get when i run the npx create-react-app myApp
npm ERR! code E404
npm ERR! 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
npm ERR! 404
npm ERR! 404 'create-react-app#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxxx\AppData\Roaming\npm-cache\_logs\2020-08-03T13_11_39_879Z-debug.log
Install for [ 'create-react-app#latest' ] failed with code 1
The issue was the wrong registrty was being pointed at. Fixed with npm config set registry https://registry.npmjs.com/ run from a prompt or terminal. Thanks for those who attempted to help.
Ciao, if you want to create an app from npm, try:
npm init react-app my-app
there is also a way using yarn:
yarn create react-app my-app
Check here for more info about create an app with create-react-app.

npm install error Unexpected end of JSON input while parsing near

0 info it worked if it ends with ok
1 verbose cli [
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',
1 verbose cli 'react-bootstrap',
1 verbose cli 'bootstrap'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.17.0
4 verbose npm-session 4004d1d4d37ac517
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/react-bootstrap 521ms
8 silly fetchPackageMetaData error for react-bootstrap#latest Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
9 http fetch GET 200 https://registry.npmjs.org/bootstrap 521ms
10 silly fetchPackageMetaData error for bootstrap#latest Unexpected end of JSON input while parsing near '...7bc2df7ec608869c9c8",'
11 timing stage:rollbackFailedOptional Completed in 0ms
12 timing stage:runTopLevelLifecycles Completed in 3560ms
13 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
13 verbose stack at JSON.parse (<anonymous>)
13 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
13 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
13 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
14 verbose cwd D:\Talk2Tutor\material-kit-react-master
15 verbose Windows_NT 10.0.17134
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "react-bootstrap" "bootstrap"
17 verbose node v12.17.0
18 verbose npm v6.14.4
19 error Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
20 verbose exit [ 1, true ]
I got above error while running npm i react-bootstrap bootstrap. After the error occurred, I tried npm cache clean --force but it didn't resolve my problem. Then I reinstalled node and tried to install dependencies but I still get an error and installation is failed. Any one fixed this error. I tried all the things mentioned in the related question. But it didn't solve my problem. I use node v12.17.0 and npm 6.14.4.
I tried by executing command npm cache clean --force and then executed the command that caused this error and it worked fine.
Upgrade npm using npm-windows-upgrade solved the issue.
After running the command npm cache clean --force . You need to remove the package-lock.json file. This worked for me.
Popper.js is required if you're using Bootstrap JS. Check the docs

Problem with npm install... npm ERR! code E400

Firstly I installed the latest version of angular cli. Then when I tried to downgrade to 7.3.3 there was an error: 400 Bad Request - GET https://github.com/. Also I can not install anything with npm install like node-sass etc. So I unistalled nodejs and tried to install again angular cli, but the same error appeared. Maybe I have changed any configuration.
CMD
C:\Windows\system32>node -v
v12.17.0
C:\Windows\system32>npm install -g #angular/cli
npm ERR! code E400
npm ERR! 400 Bad Request - GET https://github.com/
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XXXX\AppData\Roaming\npm-cache\_logs\2020-06-01T10_49_37_560Z-debug.log
Logs
0 info it worked if it ends with ok
1 verbose cli [
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',
1 verbose cli '-g',
1 verbose cli '#angular/cli'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.17.0
4 verbose npm-session bc2383db262e35f5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 400 https://github.com/ 506ms
8 silly fetchPackageMetaData error for #angular/cli#latest 400 Bad Request - GET https://github.com/
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 543ms
11 verbose stack Error: 400 Bad Request - GET https://github.com/
11 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15
11 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose statusCode 400
13 verbose pkgid #angular/cli#latest
14 verbose cwd C:\Windows\system32
15 verbose Windows_NT 10.0.17763
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "#angular/cli"
17 verbose node v12.17.0
18 verbose npm v6.14.4
19 error code E400
20 error 400 Bad Request - GET https://github.com/
21 verbose exit [ 1, true ]
1.>Go to your this location
C:\Users\{your user name or ID}
2.> open .npmrc & Remove all content from .npmrc file.
3.>reopen your new command prompt
4.>again run the code , will work.
you must enable developer mode first in windows 10
setting
update & security
for developers
and enable developer mode

Npm cannot install packages with npm init

I'm trying to install next js with command below:
$c:/Desktop/next: npm init next-app nextjs-blog
Which gave me an error
npm ERR! Could not install from "Dahal\AppData\Roaming\npm-cache\_npx\14636" as it does not contain a package.json file.
Note: My Users is C:/Users/Sunita Dahal but it seems to be looking inside of Dahal. But I'm able to install global packages.
reinstalling & cleaning cache doesnt work work me
Here is the complete error log:
0 info it worked if it ends with ok
1 verbose cli [
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',
1 verbose cli 'create-next-app#latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli 'C:\\Users\\Sunita',
1 verbose cli 'Dahal\\AppData\\Roaming\\npm-cache\\_npx\\14636',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.3
4 verbose npm-session a7314bdab23f336e
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for file:Dahal\AppData\Roaming\npm-cache\_npx\14636 Could not install from "Dahal\AppData\Roaming\npm-cache\_npx\14636" as it does not contain a package.json file.
8 http fetch GET 304 https://registry.npmjs.org/create-next-app 167ms (from cache)
9 silly pacote tag manifest for create-next-app#latest fetched in 190ms
10 timing stage:rollbackFailedOptional Completed in 1ms
11 timing stage:runTopLevelLifecycles Completed in 204ms
12 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\Sunita Dahal\Desktop\next\Dahal\AppData\Roaming\npm-cache\_npx\14636\package.json'
13 verbose cwd C:\Users\Sunita Dahal\Desktop\next
14 verbose Windows_NT 10.0.18362
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-next-app#latest" "--global" "--prefix" "C:\\Users\\Sunita" "Dahal\\AppData\\Roaming\\npm-cache\\_npx\\14636" "--loglevel" "error" "--json"
16 verbose node v12.16.3
17 verbose npm v6.14.4
18 error code ENOLOCAL
19 error Could not install from "Dahal\AppData\Roaming\npm-cache\_npx\14636" as it does not contain a package.json file.
20 verbose exit [ 1, true ]
SOLUTION
Changing my cache path fixed the issue for me.
npm config set cache C:\tmp\nodejs\npm-cache --global
more at: https://github.com/zkat/npx/issues/146
So the command npm init will initialize a new project and generate a package.json file that contains project-related information. The command can be run anywhere. Use npm init when you want to create a new project of your own.
However, npm install, or npm i for short, will install project-related dependencies in the package.json file in an existing project directory. You can also use npm i package_name_here to install new package to your current project. The command must be run in an existing project directory with a valid package.json

Resources