在vs代码中运行“ ng new projectName”时,出现以下错误。
ng new VirtualScroll
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS [ http://sass-lang.com ]
CREATE VirtualScroll/angular.json (3922 bytes)
.
.
.
CREATE VirtualScroll/e2e/src/app.po.ts (204 bytes)
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN tarball tarball data for @angular/compiler@~7.1.0 (sha512-AvYXtjEJ27Rhv4c27DXNEa58Lit63jdydzbz7VuyFhNU+FwDUK2DC4gZe0nWZsf7HUniJezVRFkECDCZQeSKCQ==) seems to be corrupted. Trying one more time.
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\less-8679cb3c\test\less\no-strict-math\mixins-guards.less'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\less-8679cb3c\test\less\no-strict-math\no-sm-operations.less'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\less-8679cb3c\test\less\postProcessorPlugin\postProcessor.less'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\less-8679cb3c\test\less\strict-units\strict-units.less'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\common-7dabc48e\testing\src\location_mock.d.ts'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\common-7dabc48e\testing\src\mock_location_strategy.d.ts'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\common-7dabc48e\testing\src\testing.d.ts'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\common-7dabc48e\testing\testing.d.ts'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\common-7dabc48e\testing\testing.metadata.json'
npm ERR! path C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\compiler-8dda22ba\fesm2015\compiler.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\compiler-8dda22ba\fesm2015\compiler.js'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\compiler-8dda22ba\fesm2015\compiler.js']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\ykhatri\Documents\Angular\VirtualScroll\node_modules\.staging\@angular\compiler-8dda22ba\fesm2015\compiler.js'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\ykhatri\\Documents\\Angular\\VirtualScroll\\node_modules\\.staging\\@angular\\compiler-8dda22ba\\fesm2015\\compiler.js' },
npm ERR! stack:
npm ERR! "Error: EPERM: operation not permitted, unlink 'C:\\Users\\ykhatri\\Documents\\Angular\\VirtualScroll\\node_modules\\.staging\\@angular\\compiler-8dda22ba\\fesm2015\\compiler.js'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\ykhatri\\Documents\\Angular\\VirtualScroll\\node_modules\\.staging\\@angular\\compiler-8dda22ba\\fesm2015\\compiler.js',
npm ERR! parent: 'virtual-scroll' }
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 ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ykhatri\AppData\Roaming\npm-cache\_logs\2019-01-16T14_58_04_245Z-debug.log
Package install failed, see above.
我尝试了以下解决方案,但错误相同
npm清理缓存--force
重新安装了node.js
npm install -g @angular/cli
全局重新安装了角度cli angular cli版本:-
Angular CLI: 7.1.1
Node: 11.6.0
OS: win32 x64
项目的所有这些警告和错误的node_modules文件夹之后仅包含空文件夹
.....\VirtualScroll\node_modules\.staging\@angular\compiler-8dda22ba\esm2015\src\render3
答案 0 :(得分:0)