Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Edits by @JLHwung

Đang mở
#919 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
15/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, webpack
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Báo cáo bao gồm một package.json và cấu hình webpack, nhưng đây là nội dung được nhập từ issue 8599 của Babel và hướng người đọc đến một bình luận cụ thể ở đó. Hãy bắt đầu với cuộc thảo luận được liên kết đó và so sánh thiết lập dependency được hiển thị ở đây; payload không xác định thay đổi nào đối với repository cũng như điều kiện hoàn tất có thể kiểm chứng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

info-needed

Edits by @JLHwung

If you hit this issue via search engines, please refer to https://github.com/babel/babel/issues/8599#issuecomment-417880788.


Bug Report

Current Behavior
Recently I'm trying to setup babel with webpack. and I'm getting an error.

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! webpack-4-tutorial@1.0.0 build: `webpack --mode production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the webpack-4-tutorial@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mentos\AppData\Roaming\npm-cache\_logs\2018-09-01T10_50_57_222Z-debug.log

package.json

{
  "name": "webpack-4-tutorial",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack --mode development",
    "build": "webpack --mode production"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.0",
    "babel-preset-env": "^1.7.0",
    "webpack": "^4.17.1",
    "webpack-cli": "^3.1.0"
  }
}

package.json

// webpack v4
const path = require('path');
module.exports = {
    entry: { main: './src/index.js' },
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'main.js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader"
                }
            }
        ]
    }
};

Expected behavior/code
Babel Configuration (.babelrc, package.json, cli command)

{
    "presets": [
        "env"
    ]
}

debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@6.2.0
3 info using node@v10.9.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle webpack-4-tutorial@1.0.0~prebuild: webpack-4-tutorial@1.0.0
6 info lifecycle webpack-4-tutorial@1.0.0~build: webpack-4-tutorial@1.0.0
7 verbose lifecycle webpack-4-tutorial@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle webpack-4-tutorial@1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Playground\webpack-4-tutorial\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\Users\Mentos\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Microsoft VS Code\bin;C:\Users\Mentos\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Mentos\AppData\Roaming\npm
9 verbose lifecycle webpack-4-tutorial@1.0.0~build: CWD: D:\Playground\webpack-4-tutorial
10 silly lifecycle webpack-4-tutorial@1.0.0~build: Args: [ '/d /s /c', 'webpack --mode production' ]
11 silly lifecycle webpack-4-tutorial@1.0.0~build: Returned: code: 2  signal: null
12 info lifecycle webpack-4-tutorial@1.0.0~build: Failed to exec build script
13 verbose stack Error: webpack-4-tutorial@1.0.0 build: `webpack --mode production`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:961:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
14 verbose pkgid webpack-4-tutorial@1.0.0
15 verbose cwd D:\Playground\webpack-4-tutorial
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.9.0
19 verbose npm  v6.2.0
20 error code ELIFECYCLE
21 error errno 2
22 error webpack-4-tutorial@1.0.0 build: `webpack --mode production`
22 error Exit status 2
23 error Failed at the webpack-4-tutorial@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Environment

  • Babel version(s): 6.26.3
  • Node/npm version: Node 10.9.0/npm 6.2]
  • OS: Windows 10
  • How you are using Babel:loader

Possible Solution

Additional context/Screenshots
I follow the same step in past and it was work fine.

image

Originally posted by @palak-temp in https://github.com/babel/babel/issues/8599

Ngôn ngữ chính
TypeScript
Star
3k
Fork
461
Merge trung bình
18 phút
Pull request đã merge (30 ngày)
5

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của devcontainers/cli

Tất cả issue của devcontainers/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.