2017-02-17 23 views
0

У меня есть старое приложение AngularJS (1), которое раньше начиналось нормально.Неопределенные объекты в файле Grunt для старого приложения AngularJS

После обновления моих зависимостей вчера объекты module и require (среди других) теперь не определены.

// 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); 

    ... 

} 

Вот мое содержание 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": "*" 
    } 
} 

И содержание 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" 
    } 
} 

Я бегу узел 6.8.1.

Нет зависимости не устарели:

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

Журнал консоли показывает нагрузки таких линий:

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. 

ответ

0

В каталоге проекта я хотел бы попробовать:

npm uninstall 
npm install -g grunt-cli 
npm install 

Свежей установки ваших зависимостей (особенно Grunt) может быть тем, что вам нужно. Если нет, это стоит сделать, прежде чем устранить неполадки.

+0

Я только что запустил команды 'npm', но ничего не изменил. – Stephane