Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error TS5023: Unknown compiler option 'p'

I am facing this issue while running the task in Visual studio code. Here is the screen shot for reference.

enter image description here

here is the code for tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "tsc",
    "isShellCommand": true,
    "args": ["-p", "."],
    "showOutput": "always",
    "problemMatcher": "$tsc"
}

and code for tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": true,
    "noEmitOnError": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node"
  },
  "exclude": [
    "node_modules",
    "wwwroot",
    "typings"
  ],
  "compileOnSave": true
}

and code for systemjs.config.js

/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
    // map tells the System loader where to look for things
    var map = {
        'app': 'app', // 'dist',
        '@angular': 'node_modules/@angular',
        'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
        'rxjs': 'node_modules/rxjs'
    };
    // packages tells the System loader how to load when no filename and/or no extension
    var packages = {
        'app': { main: 'main.js', defaultExtension: 'js' },
        'rxjs': { defaultExtension: 'js' },
        'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
    };
    var ngPackageNames = [
      'common',
      'compiler',
      'core',
      'http',
      'platform-browser',
      'platform-browser-dynamic',
      'router',
      'router-deprecated',
      'upgrade',
    ];
    // Individual files (~300 requests):
    function packIndex(pkgName) {
        packages['@angular/' + pkgName] = { main: 'index.js', defaultExtension: 'js' };
    }
    // Bundled (~40 requests):
    function packUmd(pkgName) {
        packages['@angular/' + pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
    };
    // Most environments should use UMD; some (Karma) need the individual index files
    var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
    // Add package entries for angular packages
    ngPackageNames.forEach(setPackageConfig);
    var config = {
        map: map,
        packages: packages
    }
    System.config(config);
})(this);

Please help me in resolving this issue i have no idea what i did wrong.

like image 955
rashfmnb Avatar asked Jul 04 '16 19:07

rashfmnb


2 Answers

seairth is correct,

you can run tsc --version to see if it is the new version of tsc you just installed, or tsc --help to see if -p is the supported option, e.g. I've installed a new version 2.5.2, but when I run tsc --version, it always report 1.0.3

it should be caused by path conflicting, delete the tsc path in Microsoft SDK from PATH environment, e.g. C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\; should solve the problem.

like image 67
aaron Avatar answered Oct 11 '22 09:10

aaron


You may be running an older version of TypeScript that was installed with another package, such as the Microsoft SDK. Bring up a console and execute tsc. Make sure it is the version you are expecting it to be. If not, then you will need to correct your path environment variable to ensure that the correct version is found first.

like image 40
seairth Avatar answered Oct 11 '22 07:10

seairth