Angular.js: Bug : TypeError : tentative d'affectation à la propriété en lecture seule.

Créé le 10 oct. 2017  ·  3Commentaires  ·  Source: angular/angular.js

Je soumets un...

  • [x] rapport de bogue
  • [ ] demande de fonctionnalité
  • [ ] autre (Veuillez ne pas envoyer de demandes d'assistance ici (voir ci-dessus))

Comportement actuel :

PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  TypeError: Attempted to assign to readonly property.
  at node_modules/angular-mocks/angular-mocks.js:18

Comportement attendu / nouveau :

J'utilise actuellement Ubuntu 16.04 avec virtualenv, cette erreur l'empêche d'exécuter mon serveur frontal. Ce qui rend difficile le travail sur le backend.

Reproduction minimale du problème avec instructions :

fonctionnement.
gulp dev:runserver

Erreur entière

[18:25:34] Using gulpfile ~/OpenSource/evalai/gulpfile.js
[18:25:34] Starting 'dev:runserver'...
[18:25:34] Starting 'dev'...
[18:25:34] Starting 'clean'...
[18:25:34] Finished 'clean' after 50 ms
[18:25:34] Starting 'css'...
[18:25:34] Starting 'js'...
[18:25:34] Finished 'js' after 26 ms
[18:25:34] Starting 'html'...
[18:25:34] Finished 'html' after 1.96 ms
[18:25:34] Starting 'images'...
[18:25:34] Starting 'vendorjs'...
Required path doesn't exist: /home/isht3/OpenSource/evalai/bower_components/angular-material-datetimepicker/dist/angular-material-datetimepicker.min.js angular-material-datetimepicker
[18:25:34] Finished 'vendorjs' after 895 μs
[18:25:34] Starting 'vendorcss'...
Required path doesn't exist: /home/isht3/OpenSource/evalai/bower_components/angular-material-datetimepicker/css/material-datetimepicker.css angular-material-datetimepicker
[18:25:34] Finished 'vendorcss' after 430 μs
[18:25:34] Starting 'fonts'...
[18:25:34] Starting 'configDev'...
[18:25:34] Finished 'configDev' after 4.82 ms
[18:25:34] Finished 'fonts' after 222 ms
[18:25:34] Finished 'images' after 232 ms
[18:25:34] Finished 'css' after 576 ms
[18:25:34] Starting 'inject'...
[18:25:34] Finished 'inject' after 4.73 ms
[18:25:34] Finished 'dev' after 634 ms
[18:25:34] Starting 'lint'...
[18:25:35] gulp-inject 9 files into base.html.
[18:25:36] Finished 'lint' after 1.56 s
[18:25:36] Starting 'connect'...
[18:25:36] Finished 'connect' after 17 ms
[18:25:36] Starting 'watch'...
[18:25:36] Finished 'watch' after 135 ms
[18:25:36] Starting 'test:watch'...
[18:25:36] Server started http://localhost:8888
10 10 2017 18:25:36.655:WARN [watcher]: Pattern "/home/isht3/OpenSource/evalai/frontend/dist/vendors/*.js" does not match any file.
10 10 2017 18:25:36.696:WARN [karma]: No captured browser, open http://localhost:9876/
10 10 2017 18:25:36.705:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
10 10 2017 18:25:36.705:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
10 10 2017 18:25:36.730:INFO [launcher]: Starting browser PhantomJS
10 10 2017 18:25:37.024:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket JifOUk5oAkoB3DrkAAAA with id 22967302

START:
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  TypeError: Attempted to assign to readonly property.
  at node_modules/angular-mocks/angular-mocks.js:18

Finished in 0.143 secs / 0 secs @ 18:25:37 GMT+0530 (IST)

SUMMARY:
✔ 0 tests completed

J'ai beaucoup cherché, je n'ai rien trouvé sur la façon dont je pourrais le résoudre. Je suis nouveau sur angulaire.

ngMock more info

Tous les 3 commentaires

Quelle version d'AngularJS utilisez-vous ? Qu'y a-t-il sur la ligne 18 node_modules/angular-mocks/angular-mocks.js (mentionnée dans la trace de la pile) ?

C'est une grosse supposition car vous n'avez pas fourni suffisamment d'informations pour être certain, mais je crois que la ligne où vous obtenez l'erreur est

angular.mock = {};

ce qui implique que angular.mock est une propriété en lecture seule ou peut-être que angular n'existe pas. Dans ce dernier cas, je suppose que le message d'erreur est un faux-fuyant ?

Si tel est le cas, il se peut que vous n'ayez pas chargé le fichier angular.js avant de charger le fichier angular-mocks.js ?

@gkalpak @petebacondarwin Je ne sais pas exactement ce qui n'allait pas, je n'ai pas assez d'expérience de débogage sur Angular, mais cela a été résolu lorsque j'ai exécuté bower install angular-material-datetimepicker . J'ai vu quelques problèmes à ce sujet dans le passé, j'espère que cela aidera quiconque rencontre cette erreur.

Cette page vous a été utile?
0 / 5 - 0 notes