Comments (12)
npm install已经安装了包
from nuxt-bnhcp.
@xihadandan 改成yarn install 就好了
from nuxt-bnhcp.
项目跑不起来 yarn install 也有各种错误
from nuxt-bnhcp.
@chengwenxin 什么错误
from nuxt-bnhcp.
升级一下webpack 就可以了
from nuxt-bnhcp.
我的环境:
node v8.11.3
yarn run v1.9.4
webpack 3.12.0
vue 2.9.6
yarn install 出错
████████████████████ 10% building modules[BABEL] Note: The code generator has deoptimised the styling of "/Volumes/vim/share/bnhcp/.nuxt/App.js" as it exceeds the max of "500KB".
████████████████████ 91% additional chunk assets processing
<--- Last few GCs --->
[9922:0x102802400] 997603 ms: Mark-sweep 1428.1 (1551.2) -> 1428.1 (1519.2) MB, 2322.1 / 0.0 ms last resort GC in old space requested
[9922:0x102802400] 999988 ms: Mark-sweep 1428.1 (1519.2) -> 1428.1 (1519.2) MB, 2384.8 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x2aa3aa25879
1: /* anonymous */ [/Volumes/vim/share/pinta/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:~342] [pc=0x1e2a262781af](this=0x2aa3028c209 ,chunk=0x2aa58d1ea01 <String[15]: }\r\n>,original=0x2aab866d489 )
2: SourceNode_walk [/Volumes/vim/share/pinta/node_modules/webpack-sources/node_modules/source-map/lib/sou...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/Users/ts/.nvm/versions/node/v8.11.3/bin/node]
2: node::FatalException(v8::Isolate*, v8::Localv8::Value, v8::Localv8::Message) [/Users/ts/.nvm/versions/node/v8.11.3/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/ts/.nvm/versions/node/v8.11.3/bin/node]
4: v8::internal::Factory::NewUninitializedFixedArray(int) [/Users/ts/.nvm/versions/node/v8.11.3/bin/node]
5: v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacity(v8::internal::Handlev8::internal::JSObject, unsigned int) [/Users/ts/.nvm/versions/node/v8.11.3/bin/node]
6: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/ts/.nvm/versions/node/v8.11.3/bin/node]
7: 0x1e2a251042fd
8: 0x1e2a262781af
9: 0x1e2a25ffdc5e
10: 0x1e2a25ffdda7
/bin/sh: line 1: 9922 Abort trap: 6 nuxt build
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
看了.nuxt文件夹的App.js文件有3.2M,诸如开头是
import Vue from 'vue'
import NuxtLoading from './components/nuxt-loading.vue'
let layouts = {
"_default": () => import('../layouts/default.vue' /* webpackChunkName: "layouts/default" */).then(m => m.default || m),
"_node_modules/@babel/code-frame/lib/index": () => import('../layouts/node_modules/@babel/code-frame/lib/index.js' /* webpackChunkName: "layouts/node_modules/@babel/code-frame/lib/index" */).then(m => m.default || m),"
_node_modules/@babel/generator/。。。。。。。。。省略
编辑App.js如下
import Vue from 'vue'
import NuxtLoading from './components/nuxt-loading.vue'
let layouts = {
"_default": () => import('../layouts/default.vue' /* webpackChunkName: "layouts/default" */).then(m => m.default || m)
}
let resolvedLayouts = {}
export default {
head: {"title":"bobo","meta":[{"charset":"utf-8"},{"name":"viewport","content":"width=device-width, initial-scale=1"},{"hid":"description","name":"description","content":"{{escape description }}"}],"link":[{"rel":"icon","type":"image\u002Fx-icon","href":"\u002Ffavicon.ico"},{"rel":"stylesheet","href":"\u002Fcommon\u002Fcommon.css"}],"style":[],"script":[]},
render(h, props) {
const loadingEl = h('nuxt-loading', { ref: 'loading' })
const layoutEl = h(this.layout || 'nuxt')
const templateEl = h('div', {
domProps: {
id: '__layout'
},
key: this.layoutName
}, [ layoutEl ])
const transitionEl = h('transition', {
props: {
name: 'layout',
mode: 'out-in'
}
}, [ templateEl ])
return h('div',{
domProps: {
id: '__nuxt'
}
}, [
loadingEl,
transitionEl
])
},
data: () => ({
layout: null,
layoutName: ''
}),
beforeCreate () {
Vue.util.defineReactive(this, 'nuxt', this.$options.nuxt)
},
created () {
// Add this.$nuxt in child instances
Vue.prototype.$nuxt = this
// add to window so we can listen when ready
if (typeof window !== 'undefined') {
window.$nuxt = this
}
// Add $nuxt.error()
this.error = this.nuxt.error
},
mounted () {
this.$loading = this.$refs.loading
},
watch: {
'nuxt.err': 'errorChanged'
},
methods: {
errorChanged () {
if (this.nuxt.err && this.$loading) {
if (this.$loading.fail) this.$loading.fail()
if (this.$loading.finish) this.$loading.finish()
}
},
setLayout (layout) {
if (!layout || !resolvedLayouts['_' + layout]) layout = 'default'
this.layoutName = layout
let _layout = '_' + layout
this.layout = resolvedLayouts[_layout]
return this.layout
},
loadLayout (layout) {
if (!layout || !(layouts['_' + layout] || resolvedLayouts['_' + layout])) layout = 'default'
let _layout = '_' + layout
if (resolvedLayouts[_layout]) {
return Promise.resolve(resolvedLayouts[_layout])
}
return layouts[_layout]()
.then((Component) => {
resolvedLayouts[_layout] = Component
delete layouts[_layout]
return resolvedLayouts[_layout]
})
.catch((e) => {
if (this.$nuxt) {
return this.$nuxt.error({ statusCode: 500, message: e.message })
}
})
}
},
components: {
NuxtLoading
}
}
再yarn start 报No SSR build!
yarn run v1.9.4
$ nuxt start
ERROR
Error: No SSR build! Please start with nuxt start --spa
or build using nuxt build --universal
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
from nuxt-bnhcp.
@yiibase yarn dev 试试
from nuxt-bnhcp.
@yiibase yarn dev 试试
出现一样错误,请问能正常打包的具体环境(含版本)是 ?
from nuxt-bnhcp.
@yiibase
node 版本 v8.9.1
yarn 版本 1.3.2
mac系统
刚才试了一下可以的 yarn dev
from nuxt-bnhcp.
@yiibase
node 版本 v8.9.1
yarn 版本 1.3.2
mac系统
刚才试了一下可以的 yarn dev
您文件都没传完,敷衍的回答。虽然打包出错至少我贴出.babelrc文件,帮看看
{
"presets": ["es-2015","stage-2"],
"plugins": [
["transform-runtime", {
"helpers": false,
"polyfill": false,
"regenerator": true,
"moduleName": "babel-runtime"
}]
],
"compact": false
}
from nuxt-bnhcp.
@yiibase 项目的所有前后台文件 都已提交。
from nuxt-bnhcp.
@yiibase 项目的所有前后台文件 都已提交。
nuxt/dist/文件夹没有
from nuxt-bnhcp.
Related Issues (20)
- 请教一下,npm run dev报错?检查路径发现确实没有这个build\main.js HOT 2
- 您好,请问一下,项目部署到engix服务器,npm install安装依赖时报错,如何解决? HOT 1
- 文件缺失 HOT 1
- 数据库文件没有,跑步起来啊 HOT 3
- 请问你把后台管理放出来吗? HOT 5
- 请问你是怎么防止路由和api冲突的? HOT 1
- 请教,如果后端接口是java写的,那我该如何改造 HOT 3
- 进入列表页报错 HOT 1
- 本地运行 sql文件 缺少course表 HOT 4
- yarn dev报错 HOT 2
- 想问下,您开发nuxt项目是怎么进行服务端和客户端调试的?能通过打断点调试吗
- 请问根目录下的nuxt文件夹是用来做什么的?好像删掉它运行项目并无影响 HOT 2
- 课程详情页刷新页面 Server error,怎么解决呢
- sql没上传最新的吧,少表 HOT 4
- 好像是跨域错误该怎么处理 HOT 2
- 只有手机应用么?没有PC版的么? HOT 2
- 你这个seo 怎么样,听说vue的 seo 很麻烦? HOT 2
- 根目录下的数据库文件不全,能给个全的吗
- @lin-xin 可以联系我qq 截图 我看看。我这边是可以的。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt-bnhcp.