2017-10-31 16 views
0

私は困惑する構文エラーがあります。 私は を実行した同じディレクトリにnode_modulesディレクトリを持っています。npmはtscを実行します。すべては正常です。構文エラーはありません。node_modulesディレクトリを移動すると構文エラーが発生する

私はあなたを惜しまない理由から、node_modulesディレクトリをホームディレクトリ〜に移動します。いいえディレクトリの変更は、私は、NPMの実行TSCを再実行していないと私は構文エラーを取得:

../../../../../node_modules/@types/react-select/index.d.ts(18,46): error TS1005: ',' expected. 

../../../../../node_modules/@types/react-select/index.dを。 ts(22,31):エラーTS1005: '、'が必要です。 ../../../../../node_modules/@types/react-select/index.d.ts(23,27):エラーTS1005: '、'が必要です。 ../../../../../node_modules/@types/react-select/index.d.ts(24,36):エラーTS1005: '、'が必要です。 ../../../../../node_modules/@types/react-select/index.d.ts(29,39):エラーTS1005: '、'が必要です。 ../../../../../node_modules/@types/react-select/index.d.ts(30,39):エラーTS1005: '、'が必要です。

package.jsonは以下のとおりです。

{ 
    "name": "plugin", 
    "version": "7.0.1", 
    "scripts": { 
    "tsc": "tsc -p tsconfig.json", 
    "tsc:w": "tsc -p tsconfig.json -w", 
    "lite": "lite-server", 
    "start": "npm run tsc && concurrently \"npm run tsc:w\" \"npm run lite\" " 
    }, 
    "license": "MIT", 
    "dependencies": { 
    "@angular/common": "4.2.6", 
    "@angular/compiler": "4.2.6", 
    "@angular/compiler-cli": "4.2.6", 
    "@angular/core": "4.2.6", 
    "@angular/forms": "4.2.6", 
    "@angular/http": "4.2.6", 
    "@angular/platform-browser": "4.2.6", 
    "@angular/platform-browser-dynamic": "4.2.6", 
    "@angular/platform-server": "4.2.6", 
    "@angular/animations": "4.2.6", 
    "@angular/router": "4.2.6", 
    "ag-grid": "13.3.1", 
    "ag-grid-angular": "13.3.0", 
    "bootstrap": "3.3.6", 
    "core-js": "2.4.1", 
    "jquery": "3.1.1", 
    "lodash": "4.17.4", 
    "moment": "2.17.1", 
    "rxjs": "5.4.2", 
    "systemjs": "0.20.14", 
    "zone.js": "0.8.12", 
    "primeng": "^4.2.0", 
    "ng2-split-pane": "^1.3.1", 
    "font-awesome": "^4.7.0", 
    "base64-js": "1.2.1", 
    "@types/react": "^16.0.2", 
    "@types/react-select": "^1.0.58", 
    "lite-server": "2.2.2", 
    "typescript": "^2.4.2", 
    "concurrently": "3.5.0" 
    } 
} 

任意の考え?

答えて

0

node_modulesディレクトリは、package.jsonと同じディレクトリにある必要があります。一方を移動し、他方を移動しない場合、package.jsonのディレクトリにnpm installを実行しないと、ノードは探しているものを見つけることができません。

最初に手動でnode_modulesフォルダを移動しないでください。

+0

私がやっていることは、package.jsonを自分のホームディレクトリにコピーしてnpm installを実行することと同じです。どちらのアプローチでも同じエラーが発生する – reza

関連する問題