我是angular的新手,但目前正在尝试设置一个angular项目。我执行了yo angular,在最初的步骤之后,我最终提出了以下问题:
? Overwrite package.json? (ynaxdH)
y) overwrite
n) do not overwrite
a) overwrite this and all others
x) abort
d) show the differences between the old and the new
h) Help, list all options
Answer: 我不确定真正要使用什么选项。这是一个全新的项目。因此,我选择了d选项来了解它们之间的区别。
?是否覆盖package.json?显示新旧版本之间的差异
removed added
{
"name": "client",
"private": true,
"devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^1.0.2",
"grunt-contrib-htmlmin": "^0.4.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-jscs": "^1.8.0",
"grunt-newer": "^1.1.0",
"grunt-ng-annotate": "^0.9.2",
"grunt-postcss": "^0.5.5",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^3.0.0",
"grunt-wiredep": "^2.0.0",
"jit-grunt": "^0.9.1",
"time-grunt": "^1.0.0",
"jshint-stylish": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "karma start test/karma.conf.js"
}
}基本上如下所示:
},
"scripts": {
"test": "karma start test/karma.conf.js"
}发布于 2017-06-15 20:24:17
我猜您所做的是在没有安装所有必需的依赖项的情况下运行生成器,因此它创建了package.json,但中途退出。
如果您正在开始一个全新的项目,并且还没有安装任何依赖项,那么覆盖package.json确实没有什么坏处。
生成器试图安装的代码片段实际上是npm的一个非常方便的特性。
},
"scripts": {
"test": "karma start test/karma.conf.js"
}"test"是一个脚本,您可以从命令行执行该脚本来运行与其相关的任务:"karma start test/karma.conf.js"。此任务将执行单元测试,并告诉您应用程序正在按预期工作。你可以在这里阅读更多关于因果报应的内容:https://github.com/karma-runner/karma
},
"scripts": {
"test": "karma start test/karma.conf.js",
"fun-script": "echo 'Hello world!"
}我希望这能有所帮助:)
https://stackoverflow.com/questions/44552706
复制相似问题