nic*_*as_ 16 powershell node.js angular
尝试创建新的 angular 项目时,我不断收到相同的错误消息。我尝试使用 Windows Powershell 和以下命令创建一个新的 angular 项目:
ng 新的你好世界
-> 你想添加角度路由吗?- 是的
-> 样式表格式?- CSS
我得到了下面的错误信息。我已经尝试重新安装 angular cli,并且正在使用管理员运行 Powershell。
已安装版本:
角 CLI:8.0.6
节点:10.16.0
操作系统:win32 x64
错误信息:
npm WARN tarball data for tslint@~5.15.0 (sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for jasmine-spec-reporter@~4.2.1 (sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for acorn@^6.0.5 (sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for @angular/language-service@~8.0.3 (sha512-04XojOo9FJgEQE/rZafnaJQxPEU+//TSzTgpGoIVzCSMx+joCY/ZSSwJZPWxiHlOE57W/zX02ZY+TwcM81oTdw==) seems to be corrupted. Trying one more time.
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\@angular\platform-browser-447d0944\esm2015\animations\src\animation_builder.js'
npm ERR! path C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif',
npm ERR! parent: 'hello-world' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm WARN tar EPERM: operation not permitted, lstat 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\@angular\router-8388bfd5\esm2015\src\directives'
npm WARN tarball tarball data for typescript@3.4.4 (sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==) seems to be corrupted. Trying one more time.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\konta\AppData\Roaming\npm-cache\_logs\2019-07-01T01_21_13_653Z-debug.log
Package install failed, see above.
Run Code Online (Sandbox Code Playgroud)
小智 13
我在MAC上也遇到过这个问题。我只是在命令之前添加了“sudo”,它就起作用了。
sudo npm install -g parcel-bundler
Run Code Online (Sandbox Code Playgroud)
Qad*_*ain 11
在 windows10 中,我禁用了 windows 防御者/windows 安全 ==> 实时保护,然后再试一次 npm install 命令,它起作用了
注意:安装完成后再次打开实时保护。
我只想根据卡迪尔·侯赛因的答案添加一个小答案。
如果您在Windows安全中禁用“实时保护”,那么您的笔记本电脑或PC将很容易受到任何在“实时保护”关闭时可能感染的病毒的攻击。如果您只安装 NPM 软件包,这似乎有点不可能,但某些应用程序可能有一个隐藏的后台进程等待“实时保护”被禁用,当它被禁用时,它可能会注入病毒。
话虽如此,仍然有一个选择。
选择node_modules出现问题的目录。
最后但并非最不重要的一点是,允许管理权限。
最后,退出Windows安全。
我不建议排除整个项目文件夹,因为这将禁用对该目录的所有扫描。
这里有一个小小的免责声明,我只是将这个答案作为帮助他人而不禁用“实时保护”的一种手段。虽然我不鼓励这样做,但这可能有助于解决一个常见问题。
祝你有美好的一天。:)
| 归档时间: |
|
| 查看次数: |
41395 次 |
| 最近记录: |