2017-02-17 2 views
0

J'ai une ancienne application AngularJS (1) qui commençait à bien démarrer.Objets non définis dans un fichier Gruntfile pour une ancienne application AngularJS

Après la mise à niveau de mes dépendances hier, les objets module et require (entre autres) sont maintenant non défini.

// Generated on 2014-10-21 using generator-angular 0.9.8 
'use strict'; 

module.exports = function (grunt) { 

    // Load grunt tasks automatically 
    require('load-grunt-tasks')(grunt); 

    ... 

} 

Voici le contenu de mon fichier bower.json:

{ 
    "name": "nitro-project", 
    "version": "0.0.0", 
    "dependencies": { 
    "angular": "*", 
    "json3": "*", 
    "es5-shim": "*", 
    "stacktrace": "*", 
    "firebase": "*", 
    "angular-resource": "*", 
    "angular-cookies": "*", 
    "angular-sanitize": "*", 
    "angular-animate": "*", 
    "angular-touch": "*", 
    "angular-route": "*", 
    "angular-ui-router": "*", 
    "angular-translate": "*", 
    "angular-base64": "*", 
    "angular-bootstrap": "*", 
    "angular-utils-pagination": "*", 
    "angular-ui-utils": "*", 
    "angular-file-upload": "*", 
    "a0-angular-storage": "*", 
    "sockjs": "*", 
    "stomp-websocket": "*" 
    }, 
    "devDependencies": { 
    "angular-mocks": "*", 
    "angular-scenario": "*", 
    "karma-jasmine": "*" 
    }, 
    "appPath": "app", 
    "resolutions": { 
    "es5-shim": "*", 
    "angular": "*", 
    "angular-bootstrap": "*", 
    "angular-mocks": "*" 
    } 
} 

Et le contenu du fichier package.json:

{ 
    "name": "nitroproject", 
    "version": "0.0.0", 
    "dependencies": {}, 
    "devDependencies": { 
    "grunt": "*", 
    "grunt-autoprefixer": "*", 
    "grunt-concurrent": "*", 
    "grunt-contrib-clean": "*", 
    "grunt-contrib-concat": "*", 
    "grunt-contrib-connect": "^1.0.2", 
    "grunt-contrib-copy": "*", 
    "grunt-contrib-cssmin": "*", 
    "grunt-contrib-htmlmin": "*", 
    "grunt-contrib-imagemin": "*", 
    "grunt-contrib-jshint": "*", 
    "grunt-contrib-uglify": "*", 
    "grunt-contrib-watch": "*", 
    "grunt-filerev": "*", 
    "grunt-google-cdn": "*", 
    "grunt-karma": "*", 
    "grunt-newer": "*", 
    "grunt-ng-annotate": "*", 
    "grunt-ng-constant": "*", 
    "grunt-svgmin": "*", 
    "grunt-usemin": "*", 
    "grunt-wiredep": "*", 
    "jasmine-core": "*", 
    "jshint-stylish": "*", 
    "karma": "*", 
    "karma-chrome-launcher": "*", 
    "karma-jasmine": "*", 
    "karma-phantomjs-launcher": "*", 
    "load-grunt-tasks": "*", 
    "serve-static": "^1.11.2", 
    "time-grunt": "*" 
    }, 
    "engines": { 
    "node": ">=6.8.1" 
    }, 
    "scripts": { 
    "test": "grunt test" 
    } 
} 

Je suis en nœud 6.8.1.

Aucune dépendance sont dépassées:

[[email protected] nitro-project] 
$ npm outdated 
[[email protected] nitro-project] 

Le journal de la console affiche des charges de ces lignes:

Running "newer:jshint:all" (newer) task 

Running "jshint:all" (jshint) task 

Gruntfile.js 
    line 2 col 1 Use the function form of "use strict". 
    line 4 col 1 'module' is not defined. 
    line 7 col 3 'require' is not defined. 
    line 10 col 3 'require' is not defined. 
    line 12 col 21 'require' is not defined. 
    line 16 col 10 'require' is not defined. 
    line 147 col 19 'require' is not defined. 

Répondre

0

Dans votre répertoire de projet, je voudrais essayer:

npm uninstall 
npm install -g grunt-cli 
npm install 

Une nouvelle installation de vos dépendances (en particulier Grunt) peut être ce dont vous avez besoin. Si ce n'est pas le cas, cela vaut la peine d'essayer d'autres solutions.

+0

Je viens d'exécuter vos commandes 'npm' mais cela n'a rien changé au problème. – Stephane