我正在为我的项目使用angular-cli。它在我的本地计算机上工作正常。但是当我尝试在服务器中运行我的代码时,它显示错误。
在服务器中git pull
之后,我试图npm install
它会引发我的警告 -
npm WARN prefer global http-server@0.9.0 should be installed with -g
npm WARN cannot run in wd banbeis@0.0.0 typings install (wd=/var/www/BANBEIS/banbeis-client)
npm WARN unmet dependency /var/www/BANBEIS/banbeis-client/node_modules/angular-cli requires typings@'^1.3.1' but will load
npm WARN unmet dependency /var/www/BANBEIS/banbeis-client/node_modules/typings,
npm WARN unmet dependency which is version 0.8.1
然后,如果我ng build
它会抛出我的错误 -
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Build failed.
The Broccoli Plugin: [Funnel] failed with:
Error: ENOENT: no such file or directory, lstat 'typings'
at Error (native)
at Object.fs.lstatSync (fs.js:839:18)
at symlink (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/symlink-or-copy/index.js:60:26)
at symlinkOrCopySync (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/symlink-or-copy/index.js:55:5)
at /var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/read_compat.js:58:9
at lib$rsvp$$internal$$tryCatch (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1048:17)
at lib$rsvp$$internal$$publish (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1019:11)
at lib$rsvp$asap$$flush (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1198:9)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
The broccoli plugin was instantiated at:
at Funnel.Plugin (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/index.js:7:31)
at new Funnel (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/broccoli-funnel/index.js:44:10)
at Angular2App._buildInputTree (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/lib/broccoli/angular2-app.js:85:7)
at new Angular2App (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/lib/broccoli/angular2-app.js:51:41)
at module.exports (/var/www/BANBEIS/banbeis-client/angular-cli-build.js:6:10)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
at Class.module.exports.Task.extend.init (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
at new Class (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
at Class.module.exports.Task.extend.run (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
at /var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
at lib$rsvp$$internal$$tryCatch (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at /var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/var/www/BANBEIS/banbeis-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
如果有人帮助我解决这个问题,对我来说将是一个很大的帮助。
答案 0 :(得分:0)
CLI仍在使用pre 1.0 typings版本,但我安装了最新版本。所以我做了 -
rm -rf typings
npm run postinstall
ng serve
现在它正在运作:D