旧AngularJS应用程序的GrunFile中未定义的对象
我有一个旧的AngularJS(1)应用程序,它的启动很好 昨天升级了依赖项之后,旧AngularJS应用程序的GrunFile中未定义的对象,angularjs,gruntjs,bower,Angularjs,Gruntjs,Bower,我有一个旧的AngularJS(1)应用程序,它的启动很好 昨天升级了依赖项之后,模块和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);
模块
和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": "*"
}
}
{
"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"
}
}
以及package.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": "*"
}
}
{
"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"
}
}
我正在运行node6.8.1
没有过时的依赖项:
[stephane@stephane-ThinkPad-X301 nitro-project]
$ npm outdated
[stephane@stephane-ThinkPad-X301 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.
在您的项目目录中,我将尝试:
npm uninstall
npm install -g grunt-cli
npm install
您可能需要重新安装依赖项(尤其是Grunt)。如果没有,在进行更多故障排除之前值得一试。我刚刚运行了您的
npm
命令,但它没有改变任何问题。