尝试使用'Angular-cli'
构建项目时出现以下错误
D:\workspace\migration-project>ng build
ENOENT: no such file or directory, stat 'D:\workspace\migration-project\src\assets'
Error: ENOENT: no such file or directory, stat 'D:\workspace\migration-project\src\assets'
at Error (native)
at Object.fs.statSync (fs.js:844:18)
at D:\workspace\migration-project\node_modules\angular-cli\plugins\glob-copy-webpack-plugin.js:16:64
at Array.map (native)
at GlobCopyWebpackPlugin.apply (D:\workspace\migration-project\node_modules\angular-cli\plugins\glob-copy-webpack-plugin.js:16:29)
at Compiler.apply (D:\workspace\migration-project\node_modules\tapable\lib\Tapable.js:233:16)
at WebpackOptionsApply.process (D:\workspace\migration-project\node_modules\webpack\lib\WebpackOptionsApply.js:59:18)
at webpack (D:\workspace\migration-project\node_modules\webpack\lib\webpack.js:28:48)
at Class.exports.default.Task.extend.run (D:\workspace\migration-project\node_modules\angular-cli\tasks\build-webpack.js:20:31)
at Class.Command.extend.run (D:\workspace\migration-project\node_modules\angular-cli\commands\build.js:50:26)
at Class. (D:\workspace\migration-project\node_modules\angular-cli\lib\models\command.js:152:17)
at tryCatch (D:\workspace\migration-project\node_modules\rsvp\dist\lib\rsvp\-internal.js:215:12)
at invokeCallback (D:\workspace\migration-project\node_modules\rsvp\dist\lib\rsvp\-internal.js:230:13)
at D:\workspace\migration-project\node_modules\rsvp\dist\lib\rsvp\then.js:29:16
at flush (D:\workspace\migration-project\node_modules\rsvp\dist\lib\rsvp\asap.js:85:5)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
我实际上在 src 中没有任何 assets 目录或文件。不知道为什么要求它。
操作系统:Windows 10
webpack:2.1.0-beta.25
angular-cli:1.0.0-beta.19-3(本地和全局)
@angular& @ angular / material:最新版本
npm install
有人遇到过类似的问题吗? 任何线索都会非常有用。
更新:问题在于angular-cli。在将angular-cli回滚到1.0.0-beta.17之后问题得到了解决。
答案 0 :(得分:3)
我在更新到angular-cli版本1.0.0-beta.20-4后手动创建src / assets文件夹解决了这个问题
使用最新的angular-cli创建新项目时:
ng new migration-project
创建了一个文件夹:
src/assets
使用名为.gitkeep的文件
我还没有查看为什么需要这个文件夹,但一切都恢复正常。