我在Angular 2中尝试Hello World,当我跑#34; npm start"它不起作用。我已经在package.json的脚本中定义了start但是start没有工作
这是我的package.json设置
{
"name": "ng2-helloworld",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"postinstall": "typing install"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"concurrently": "^3.4.0",
"lite-server": "^2.3.0",
"typescript": "^2.2.2",
"typings": "^2.1.1"
}
}
这是我的tsconfig.json设置
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "none",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"lib": ["es2015", "dom"]
}
}
答案 0 :(得分:0)
你可以尝试ng serve
请参阅此快速入门angular
答案 1 :(得分:0)
我通过将“moduleResolution”替换为“none”,使用“moduleResolution”:“node”, 在
更正后的代码在这里
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"lib": ["es2015", "dom"]
}
}
答案 2 :(得分:0)
你错了,你写了无,而不是节点更正的代码在
之下这是我的package.json设置
Route::get('thisId/{thisId}/thisSection/{thisSection}', function ($thisId, $thisSection) {
//
});
这是我的tsconfig.json设置
{
"name": "ng2-helloworld",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"postinstall": "typing install"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"concurrently": "^3.4.0",
"lite-server": "^2.3.0",
"typescript": "^2.2.2",
"typings": "^2.1.1"
}
}