Как исправить ошибку пряжи при установке локального пакета? - PullRequest
0 голосов
/ 02 октября 2019

Я внес некоторые локальные изменения в пакет, который я хочу установить с помощью Yarn.

Когда я устанавливаю его через реестр npm, проблем не возникает. Мой package.json выглядит следующим образом:

{
    "private": true,
    "theia": {
        "frontend": {
            "config": {
                "applicationName": "Theia Rust Example"
            }
        }
    },
    "dependencies": {
.....
       "@theia/cpp-debug": "next",

    },
    "devDependencies": {
        "@theia/cli": "next"
    },
    "workspaces": [
      "packages/*"
    ]
}

После запуска пряжи я вижу папку node_modules / @ theia / cpp-debug. В этой папке есть папка lib, содержащая различные файлы.

Теперь, когда я использую следующий package.json:

{
    "private": true,
    "theia": {
        "frontend": {
            "config": {
                "applicationName": "Theia Rust Example"
            }
        }
    },
    "dependencies": {
.....

    },
    "devDependencies": {
        "@theia/cli": "next"
    },
    "workspaces": [
      "packages/*"
    ]
}

А затем вручную добавьте cpp-debug в качестве локальной ссылки

yarn add file:/root/theia-cpp-extension/packages/cpp-debug --ignore-workspace-root-check

Это также успешно. Но когда я в следующий раз запускаю

yarn theia build

, я получаю сообщение об ошибке:

/root/theia_rust_app/node_modules/.bin/theia build
(node:215) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead

Hash: fa3940c5f903c29cc7b7
Version: webpack 4.41.0
Time: 71483ms
Built at: 10/01/2019 10:39:48 PM
 17 assets
Entrypoint main = bundle.js bundle.js.map
  [75] (webpack)/buildin/global.js 472 bytes {0} [built]
 [150] ./node_modules/jsonc-parser/lib/esm/main.js + 4 modules 56.8 KiB {0} [built]
       |    5 modules
 [531] (webpack)/buildin/module.js 497 bytes {0} [built]
 [841] ./node_modules/react-virtualized/dist/es/index.js + 67 modules 325 KiB {0} [built]
       |    68 modules
 [847] ./src-gen/frontend/index.js 6.56 KiB {0} [built]
[1015] ./node_modules/@theia/core/src/common/keyboard/layouts sync ^\.\/.*\.json$ 1.39 KiB {0} [built]
[1220] ./node_modules/moment/locale sync ^\.\/.*$ 3 KiB {0} [optional] [built]
[1315] ./node_modules/vscode-textmate/release sync 160 bytes {0} [built]
    + 1962 hidden modules

WARNING in ./node_modules/vscode-textmate/release/main.js 23:15-27
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/@theia/monaco/lib/browser/textmate/monaco-textmate-service.js
 @ ./node_modules/@theia/monaco/lib/browser/textmate/index.js
 @ ./node_modules/@theia/textmate-grammars/lib/browser/js.js
 @ ./node_modules/@theia/textmate-grammars/lib/browser/textmate-grammars-frontend-module.js
 @ ./src-gen/frontend/index.js

WARNING in ./node_modules/vscode-textmate/release/main.js
Module Warning (from ./node_modules/source-map-loader/index.js):
(Emitted value instead of an instance of Error) Cannot find SourceMap 'main.js.map': Error: Can't resolve './main.js.map' in '/root/theia_rust_app/node_modules/vscode-textmate/release'
 @ ./node_modules/@theia/monaco/lib/browser/textmate/monaco-textmate-service.js 73:24-50
 @ ./node_modules/@theia/monaco/lib/browser/textmate/index.js
 @ ./node_modules/@theia/textmate-grammars/lib/browser/js.js
 @ ./node_modules/@theia/textmate-grammars/lib/browser/textmate-grammars-frontend-module.js
 @ ./src-gen/frontend/index.js

ERROR in ./src-gen/frontend/index.js
Module not found: Error: Can't resolve '@theia/cpp-debug/lib/browser/cpp-debug-frontend-module' in '/root/theia_rust_app/src-gen/frontend'
 @ ./src-gen/frontend/index.js 57:47-112
Child worker:
     2 assets
    Entrypoint main = worker-ext.e08cdfdcb830fe7e8493.js worker-ext.e08cdfdcb830fe7e8493.js.map
     [17] (webpack)/buildin/global.js 472 bytes {0} [built]
    [167] (webpack)/buildin/module.js 497 bytes {0} [built]
        + 181 hidden modules

Error: webpack exited with an unexpected code: 2.
    at ChildProcess.<anonymous> (/root/theia_rust_app/node_modules/@theia/application-manager/lib/application-process.js:66:28)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
error Command failed with exit code 1.

И теперь внутри папки node_modules / @ theia / cpp-debug есть пустая папка lib.

Что я делаю не так?

...