2016-06-28 4 views
0

私のプロジェクトをコンパイルするのに問題があります。私はapp - Copy/some.component.ts(6,32): error TS2307を得続けます。コンパイラは動作し、typescriptをコンパイルし、WindowsのIIS 7.5サーバーで実行するか、プロジェクトのルートディレクトリにnpm run liteを使用してアプリケーションを実行します。問題は私のpackage.jsonの私のスクリプトです。私はコンパイルしてファイルの変更を待ち続けていて、受け取ったエラーnpm run tscのためにlite-serverが動作しません。また、Atomでプロジェクトをビルドするときにも同じエラーが発生します。タイプコピーのコンパイルでTS2307エラーが発生します。

ありがとうございます。ここで

コマンドラインエラープリントアウト

> [email protected] tsc C:\inetpub\wwwroot\OPI-Training-Angular2 
> tsc 

app - Copy/app.component.ts(6,32): error TS2307: Cannot find module './logon/logon.component'. 
app - Copy/app.component.ts(7,35): error TS2307: Cannot find module './employee/employee.component'. 
app - Copy/components/logon/logon.component.ts(3,29): error TS2307: Cannot find module '../user.service'. 

npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run 
" "tsc" 
npm ERR! node v6.2.1 
npm ERR! npm v3.9.3 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] tsc: `tsc` 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the [email protected] tsc script 'tsc'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the OPI-Training package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  tsc 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs OPI-Training 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls OPI-Training 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\inetpub\wwwroot\OPI-Training-Angular2\npm-debug.log 
PS C:\inetpub\wwwroot\OPI-Training-Angular2> 

は私のフォルダ構造のスクリーンショットです。ここで

Screen Shot of folder structure

ここに私のtsconfig.ts

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": false 
    } 
} 

あるスクリプトは私のpackage.jsonファイルで

"scripts": { 
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
    }, 

、最終的には、それぞれのファイルで輸入

です

app.components.ts

import { UserService } from '../../services/users/user.service'; 
import { LogonComponent } from '../logon/logon.component'; 
import { EmployeeComponent } from '../employee/employee.component'; 

logon.components.ts

import { UserService } from '../../../app/services/users/user.service'; 
+0

インポートが見つかりません。別のTSファイルからコピーして貼り付けましたか?ルートが何かを指していないか、ルートが見つかりません – jhhoff02

+0

それはそれを見つけることです。私が輸入品の1つを変更した場合同じ3つのエラーだけでなくこれも取得してください。 'app/components/app/app.component.ts(6,32):エラーTS2307: '。/ logon/logon.component'モジュールを見つけることができません。 –

答えて

1

私はこの問題を考え出しました。私は元のアプリケーションフォルダをバックアップしました。したがって、 "app - Copy"はそれについて何も考えていません。何が起こっていたのは、npm run tscがバックアップとしてコピーしたフォルダをコンパイルしていて、どこからエラーが発生したのかということでした。 Noobの間違い。

関連する問題