IT TIP

npm 오류!

itqueen 2020. 11. 26. 20:35
반응형

npm 오류! 오류 : EPERM : 작업이 허용되지 않음, 이름 변경


"npm install"을 실행하면이 오류가 발생합니다.

npm 오류! 오류 : EPERM : 작업이 허용되지 않음, C : \ projects ****** \ node_modules \ react-async-script '->'C : \ projects ******* \ node_modules.react-async-script .지우다'

  • cmd를 관리자로 실행 중입니다.
  • 전에 npm 캐시를 청소했습니다.
  • 다른 모든 응용 프로그램에는 node_modeules와 관련된 항목이 열려 있지 않은지 확인했습니다.

제 상황에서는 도움이되었습니다.

  1. 캐시 정리

    npm cache clean --force
    
  2. 관리자 권한으로 최신 버전의 npm을 전역 적으로 설치합니다.

    npm install -g npm@latest --force
    
  3. 캐시 정리

    npm cache clean --force
    
  4. 구성 요소를 다시 설치하십시오.

문제가 해결되기를 바랍니다. 도움이되지 않으면 잠시 동안 바이러스 백신 프로그램을 전환하고 반복하십시오.


디스크에 로컬 복사본이 있어도 원격 리소스를 가져 오는 강제 옵션으로 npm 설치를 시도했을 때 작동합니다. 달리기

npm install --force

업데이트 된 이 솔루션이 작동하지 않는 내 동료 중 일부. 그러나 우리는 npm 대신 원사를 사용해 보았습니다 . 항상 문제없이 작동합니다 (더 빠릅니다).

yarn install [package-name]

아닙니다 package.json.하지만 어떤 이유로 든 node_modules/읽기 전용이되었습니다. 재설정하면 문제가 해결되었습니다.


당신이 피하려면 --force옵션을 (더 나은 방법이 항상이다) , 이 보통 내가 본 사례의 약 90 %에있는 파일을 잠금의 주된 이유이기 때문에 나는 프로젝트를 실행 당신이 중지했는지 만들기 제안

이 순서대로 다음 단계를 제안합니다.

1- Angular에서 중지 ng s하고 React에서 중지하면 npm start 일반적 으로이 문제가 해결됩니다. 왜냐하면 개발 서버가 일부 파일을 잠그고 npm이 파일을 업데이트 할 수 없기 때문에 일반적으로이 오류가 발생하기 때문입니다.

2- 위의 방법이 작동하지 않으면 작업 공간이 열려있는 코드 편집기를 닫으십시오 (일부 파일 등을 잠그고있을 수 있음).

따라서 코드 편집기를 닫고 실행 해보십시오.

npm install

3- 그래도 작동하지 않으면 --force옵션을 시도해 볼 수 있습니다.

npm install --force

동일한 오류 가 발생했으며 https://github.com/Medium/phantomjs/issues/19 에 따르면 바이러스 백신 소프트웨어로 인해 발생할 수 있습니다. 나는 설치하는 동안 나의 것을 비활성화하고 cmd에서 admin으로 "npm install"을 실행했고 그것은 작동했다. 도움이 되었기를 바랍니다.


나는 똑같은 것을 얻고 있었다. 나는 이것을 어디서도 찾지 못했지만 우리의 VM이 파일을 읽기 전용 상태로 변경하는 경향이 있다는 사실에 충격을 받았습니다. 그래서 package.json의 파일 속성을 열고 Read-only"일반"탭에서 선택을 취소 했습니다.

단계

  1. package.json파일로 이동 하십시오.
  2. 마우스 오른쪽 버튼을 클릭하고 속성을 선택 합니다.
  3. 에서 일반 탭, 속성 을 선택 취소 섹션을 읽기 전용 .
  4. 적용클릭 하여 변경 사항을 적용하십시오.

이 문제는 Windows에서만 여러 번 발생했으며 일반적으로 순서대로 시도합니다.

  1. npm 설치 --force
  2. node_modules가 읽기 전용으로 설정되어 있는지 확인하고 그렇지 않은 경우 제거하십시오.
  3. node_modules / 삭제
  4. 프로젝트의 루트 폴더에 액세스 할 수있는 편집기가 열려 있는지 확인합니다.
  5. 재부팅 :(

일반적으로 이러한 단계 중 하나를 수행 한 후에 npm 설치를 시도하면 문제가 해결됩니다.


제 경우에는 무언가가 잠 겼고 빠른 재부팅으로 해결되었습니다.


이것은 바이러스 백신으로 인해 발생하는 일반적인 오류입니다. A / V (회사 정책)를 비활성화 할 수없는 저와 같은 경우에 대한 해결 방법이 있습니다.

polyfills.js내부 Npm패키지 를 변경해야 합니다.

[NODE_HOME]/node_modules/npm/node_modules/graceful_fs/polyfills.js

이 진술을 찾으십시오.

if (process.platform === "win32") {

이 문 내부에는 오류 발생시 재 시도하는 시간 초과가 있습니다. 문제는 경우에 따라 시간 초과 후에도 파일이 A / V에 의해 여전히 잠겨 있다는 것입니다. 해결책은 시간 초과를 제거하고이 문을 반복하는 것입니다. 이전 코드의 변경 사항은 다음과 같습니다.

if (platform === "win32") {

fs.rename = (function (fs$rename) { return function (from, to, cb) {
  var start = Date.now()
  var backoff = 0;
  fs$rename(from, to, function CB (er) {
    if (er
        && (er.code === "EACCES" || er.code === "EPERM")
        /*&& Date.now() - start < 60000*/) {
            console.log("Retrying rename file: " + from + " <> " + to)
            fs$rename(from, to, CB);
      /*setTimeout(function() {
        fs.stat(to, function (stater, st) {
          if (stater && stater.code === "ENOENT")
            fs$rename(from, to, CB);
          else
            cb(er)
        })
      }, backoff)*/
      if (backoff < 100)
        backoff += 10;
      return;
    }
    if (cb) cb(er)
  })
}})(fs.rename)
}

Martin Kearn이 의견에서 지적했듯이 Visual Studio를 닫으면 이러한 npm 권한 문제가 해결되었습니다. 분명히 VS는 때때로 node_modules.


npm을 5.4.2로 업데이트 한 후에도 동일한 문제가 발생했으며 npm은 대부분의 npm 명령에 대해 동일한 오류를 제공합니다. 일부 솔루션은 --no-optional을 사용하여 실행하는 것이 좋습니다.

항상 작동하지 않았습니다.

다른 다운 그레이드 제안, 다운 그레이드하고 싶지 않았습니다.

나는 설치에 문제가 있다고 생각했지만 그것이 무엇인지 확신하지 못했습니다.

그래서 내 npm을 다시 업데이트했습니다.

npm i -g npm

그 이후로 잘 작동했습니다.


npm was failing for me at scandir for:

npm install -g webpack

...which might be caused by npm attempting to "modify" files that were potentially locked by other processes as mentioned here and in few other github threads. After force cleaning the cache, verifying cache, running as admin, disabling the AV, etc the solution that actually worked for me was closing any thing that might be placing a lock the files (i.e. restarting my computer).

I hope this helps someone struggling.


I had the same problem. The reason for the error is unsupported characters in the path to the file. Replaced the cyrillic in English - it helped.


For some, AppRoot\npm folder could be an issue. Sometimes the AppRoot folder is marked as network shared and thus Antivirus blocks the stuff. Follow below link for complete solution.

https://alastaircrabtree.com/fixing-intermittant-eperm-operation-not-permitted-on-npm-install/

I hope this helps.


Open the command prompt as administrator and navigate to the project location and then run npm install. it worked for me.


Trying to rename a file to another filename that already exists can cause an EPERM error on Windows.


My answer is to do npm cache clean --force first. Then run npm install -g npm@5.3.0 to install npm 5.3.0 version. for me, this npm version works with no trouble.


I did the following:

  1. Upgraded the npm to the latest version: npm install -g npm@6.5.0-next.0
  2. deleted the npm-cache folder from: c:/users/[username]/AppData/Roaming/npm-cache
  3. Did cache clean : npm cache clean --force
  4. Ran the npm install.

Just delete the package folder from the path of npm global packages. then reinstall the package. Note that the packages are globally installed in: C:\Users\your-name\AppData\Roaming\npm\node_modules


I was having the same problem in windows 10. Just follows these steps :

  • Open cmd as administrator.

  • install uppdated npm package.

  • npm i -g npm

  • npm init --yes


Running commands as Super Admin worked for me. Retry after closing Editor your are working in.


I remounted my window disks with the metadata flag, and instantly helped: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

after that no need anymore to use sudo for npm commands as the metadata keeps windows and linux file/directory permissions in check.


I struggeled with this too. I finaly a solution that works fine if you use nvm:

cd ~/.nvm/versions/node/{your node version}/lib/ npm install npm

and that's it.


This might be due to your Antivirus software. If you can not disable AV then you can try modifying your NPM global install location as node installs into APPDATA directory which is actively monitored by AV Engines. Try running following commands-

npm config set prefix "YOUR CUSTOM LOCATION" npm config set cache "YOUR CUSTOM LOCATION"

Delete node_modules directory and install your package again.


In my case setting typescript.disableAutomaticTypeAcquisition in Visual Studio Code to true seemed to help.


In my case running npm: v6.9.0 && node: v10.16.1 on Windows, I had to run my CLI (git bash) as administrator. Then packages were installed without any warnings/errors


For me i just closed the Code editor (VS Code) and then run the same command. And that solves the issue for me.


I face this issue multiple times. It turns out, that it has nothing to do with permissions, cache, etc. The error message is misleading. For node v 6.x you will see more detailed error stack but not after 7.x For me and my colleges, the issue is timeout function. Basically the package install has not finished yet (i.e. holding the directory) when npm tries to delete it. in node 6.x you can see that in finalize.js now it's gone! Just use yarn.

참고URL : https://stackoverflow.com/questions/39293636/npm-err-error-eperm-operation-not-permitted-rename

반응형