Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行build报错(npm run build report an error) #4211

Closed
sndwow opened this issue Jun 30, 2019 · 2 comments
Closed

运行build报错(npm run build report an error) #4211

sndwow opened this issue Jun 30, 2019 · 2 comments

Comments

@sndwow
Copy link

sndwow commented Jun 30, 2019

Version

3.8.4

Environment info

System:
    OS: Windows 10
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 10.5.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.1.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.8.0
    @vue/babel-preset-jsx:  1.0.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.0.0
    @vue/cli-overlay:  3.8.0
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0
    @vue/cli-plugin-eslint: ^3.8.0 => 3.8.0
    @vue/cli-service: ^3.8.0 => 3.8.4
    @vue/cli-shared-utils:  3.8.0
    @vue/component-compiler-utils:  2.6.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
    vue: ^2.6.10 => 2.6.10
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-router: ^3.0.3 => 3.0.6
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.0.1 => 3.1.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

1、运行 vue create vue-test
2、选择默认配置 vue_dev_conf,输入内容如下:

Vue CLI v3.8.4
? Please pick a preset: vue_dev_conf (vue-router, vuex, less, babel, eslint)

Vue CLI v3.8.4
✨  Creating project in D:\project\vue-test.
🗃  Initializing git repository...
⚙  Installing CLI plugins. This might take a while...

......

🎉  Successfully created project vue-test.
👉  Get started with the following commands:

 $ cd vue-test
 $ npm run serve

4、进入目录,运行npm run build,此时出现了报错,并且一直卡在了Building位置:

PS D:\project> cd .\vue-test\
PS D:\project\vue-test> npm run build

> vue-test@0.1.0 build D:\project\vue-test
> vue-cli-service build


\  Building for production...Unhandled rejection Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
    at SourceMapGenerator_validateMapping [as _validateMapping] (D:\project\vue-test\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (D:\project\vue-test\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:110:12)
    at D:\project\vue-test\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:72:17
    at Array.forEach (<anonymous>)
    at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (D:\project\vue-test\node_modules\webpack-sources\node_modules\source-map\lib\source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (D:\project\vue-test\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:48:24)
    at SourceMapSource.node (D:\project\vue-test\node_modules\webpack-sources\lib\SourceMapSource.js:32:35)
    at SourceMapSource.proto.sourceAndMap (D:\project\vue-test\node_modules\webpack-sources\lib\SourceAndMapMixin.js:30:18)
    at getTaskForFile (D:\project\vue-test\node_modules\webpack\lib\SourceMapDevToolPlugin.js:37:30)
    at files.forEach (D:\project\vue-test\node_modules\webpack\lib\SourceMapDevToolPlugin.js:136:20)
    at Array.forEach (<anonymous>)
    at compilation.hooks.afterOptimizeChunkAssets.tap (D:\project\vue-test\node_modules\webpack\lib\SourceMapDevToolPlugin.js:130:12)
    at SyncHook.eval [as call] (eval at create (D:\project\vue-test\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
    at SyncHook.lazyCompileHook (D:\project\vue-test\node_modules\tapable\lib\Hook.js:154:20)
    at hooks.optimizeChunkAssets.callAsync.err (D:\project\vue-test\node_modules\webpack\lib\Compilation.js:1313:42)
    at _err0 (eval at create (D:\project\vue-test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:11:1)

|  Building for production...

What is expected?

build应该能正常生成构建后的代码

What is actually happening?

构建出错


1、使用vuecli创建项目后,并未对代码进行任何更改和配置

2、运行命令的用户有管理权限

3、出错后尝试使用按顺序执行以下命令清理npm缓存

npm cache verify

npm cache clean

npm cache clean -force

4、尝试过删除node_modules目录、在不同目录尝试重新创建vue项目,结果还是报错

@sndwow sndwow changed the title 运行build报错 运行build报错(npm run build report an error) Jun 30, 2019
@sndwow
Copy link
Author

sndwow commented Jun 30, 2019

已经找到问题,感谢 @sodatea
#4210 (comment)

A bug in terser 4.0.1 which was released hours ago.
For npm users: run npm i terser@4.0.0
For yarn users: add the following field to package.json and then rerun yarn:

"resolutions": {
  "terser": "4.0.0"
}

@haoqunjiang
Copy link
Member

Fixed in terser 4.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants