vuejs-templates / webpack-simple Goto Github PK
View Code? Open in Web Editor NEWA simple Webpack + vue-loader setup for quick prototyping.
A simple Webpack + vue-loader setup for quick prototyping.
I'm hoping this is an easy solve. I'm tying to use Sass (SCSS specifically) in my .vue
file.
For example:
<style lang="sass" scoped>
$red: red;
body {
background: $red;
}
</style>
I tried adding jtangelder/sass-loader in my webpack.config.js
using a config like this:
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
},
...but no luck.
Any ideas?
Thanks!
when run dev,
Unable to open browser. If you are running in a headless environment, please do not use the open flag.
(node:24360) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
```
and run build
I just created a new webpack-simple project and was able to load the index.html page, but when I changed the msg
property in the data function in App.vue by just adding an exclamation point to the end I got this error in the console when it attempted hot module replacement. I didn't change anything else. Another user on vue Gitter channel was also able to reproduce just now.
Uncaught ReferenceError: cssModules is not defined
at eval (eval at (build.js:1009), :34:23)
at hotApply (build.js:501)
at hotUpdateDownloaded (build.js:285)
at hotAddUpdateChunk (build.js:265)
at webpackHotUpdateCallback (build.js:8)
at 0.b6ea842….hot-update.js:1
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 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle vue2@~predev: vue2@
6 silly lifecycle vue2@~predev: no script for predev, continuing
7 info lifecycle vue2@~dev: vue2@
8 verbose lifecycle vue2@~dev: unsafe-perm in lifecycle true
9 verbose lifecycle vue2@~dev: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\vue2-example-master2\vue2-example-master\node_modules.bin;C:\Users\qw\bin;C:\Program Files (x86)\Git\mingw32\bin;C:\Program Files (x86)\Git\usr\local\bin;C:\Program Files (x86)\Git\usr\bin;C:\Program Files (x86)\Git\usr\bin;C:\Program Files (x86)\Git\mingw32\bin;C:\Program Files (x86)\Git\usr\bin;C:\Users\qw\bin;C:\Program Files (x86)\Common Files\NetSarang;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\TortoiseSVN\bin;C:\Program Files\nodejs;C:\Users\qw\AppData\Local\atom\bin;C:\Users\qw\AppData\Local\Microsoft\WindowsApps;C:\Users\qw\AppData\Roaming\npm;C:\Program Files (x86)\Git\usr\bin\vendor_perl;C:\Program Files (x86)\Git\usr\bin\core_perl
10 verbose lifecycle vue2@~dev: CWD: D:\vue2-example-master2\vue2-example-master
11 silly lifecycle vue2@~dev: Args: [ '/d /s /c', 'webpack-dev-server --open --inline --hot' ]
12 silly lifecycle vue2@~dev: Returned: code: 1 signal: null
13 info lifecycle vue2@~dev: Failed to exec dev script
14 verbose stack Error: vue2@ dev: webpack-dev-server --open --inline --hot
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid vue2@
16 verbose cwd D:\vue2-example-master2\vue2-example-master
17 error Windows_NT 10.0.14393
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev"
19 error node v6.9.2
20 error npm v3.10.9
21 error code ELIFECYCLE
22 error vue2@ dev: webpack-dev-server --open --inline --hot
22 error Exit status 1
23 error Failed at the vue2@ dev script 'webpack-dev-server --open --inline --hot'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the vue2 package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error webpack-dev-server --open --inline --hot
23 error You can get information on how to open an issue for this project with:
23 error npm bugs vue2
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls vue2
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
App.vue
<style lang="sass">
body
background-color: yellow
</style>
installed:
node-sass, sass-loader
webpack.config.js
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.html$/,
loader: 'vue-html'
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'url',
query: {
limit: 10000,
name: '[name].[ext]?[hash]'
}
},
{test: /\.css$/, loader: 'vue-style-loader!css-loader'},
{test: /\.postcss$/, loader: 'vue-style-loader!css-loader'},
{
test: /\.sass$/,
loader: 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
},
{
test: /\.scss$/,
loader: 'vue-style-loader!css-loader!sass-loader'
}
]
},
npm run dev
ERROR in ./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js!./~/sass-loader!./~/vue-loader/lib/selector.js?type=style&index=0!./src/App.vue
Module build failed:
<template>
^
Invalid CSS after "": expected 1 selector or at-rule, was "body"
in /Users/herb/vuejs/webpack-simple/src/App.vue (line 1, column 1)
@ ./~/vue-style-loader!./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js!./~/sass-loader!./~/vue-loader/lib/selector.js?type=style&index=0!./src/App.vue 4:14-238 13:2-17:4 14:20-244
webpack-simple/template/index.html
Line 5 in 643e0dc
What is it for?
'//@ sourceURL' and '//@ sourceMappingURL' are deprecated, please use '//# sourceURL=' and '//# sourceMappingURL=' instead.
I just installed this and updated vue npm i -D vue
.
I get 96 of these warnings. It makes trying to find stuff I log to the console frustrating.
[email protected]
, in case that makes any difference.
I love the simplicity of this webpack setup as compared to the "full" webpack template.
The readme says "not suitable for production" but doesn't explain why. I'd love to know what exactly would be the minimum change that should be made to make it ready for production. Maybe there should be a link on the readme pointing to that information.
Performance warnings from Webpack after starting up the dev server for the first time, before touching any code.
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (250 kB).
This can impact web performance.'
'Assets:
build.js (1.35 MB)WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (250 kB). This can impact web performance.
Entrypoints:
main (1.35 MB)
build.jsWARNING in webpack performance recommendations:
You can limit the size of your bundles by using System.import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
This seems to have started just recently.
I got a error when execute npm run dev on this template, the files for a project template has correctly created, but i got a error when webpack is starting.
I did a test using another template "webpack" and works as charm
[email protected] dev /Users/danyparedes/Desktop/nba
cross-env NODE_ENV=development webpack-dev-server --open --hot
/Users/danyparedes/Desktop/nba/node_modules/cross-env/dist/bin/cross-env.js:4
require('../')(process.argv.slice(2));
^
TypeError: require(...) is not a function
at Object. (/Users/danyparedes/Desktop/nba/node_modules/cross-env/dist/bin/cross-env.js:4:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Please replace the current configuration (webpack, scripts, babel) with https://github.com/vuejs/vue-cli/releases/tag/v2.8.0 (vue build
).
Example:
"scripts": {
...
"build": "vue build src/index.js --prod --lib --config ./vue.config.js"
},
WARNING in (webpack)/hot/emitter.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* D:\Project\JS\vue-demo\node_modules\webpack\hot\emitter.js
Used by 1 module(s), i. e.
D:\Project\JS\vue-demo\node_modules\webpack-dev-server\client\index.js?http://localhost:8080
* d:\Project\JS\vue-demo\node_modules\webpack\hot\emitter.js
Used by 1 module(s), i. e.
d:\Project\JS\vue-demo\node_modules\webpack\hot\dev-server.js
WARNING in ./~/process/browser.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* D:\Project\JS\vue-demo\node_modules\process\browser.js
Used by 22 module(s), i. e.
D:\Project\JS\vue-demo\node_modules\sockjs-client\lib\main.js
* d:\Project\JS\vue-demo\node_modules\process\browser.js
Used by 1 module(s), i. e.
d:\Project\JS\vue-demo\node_modules\vue\dist\vue.common.js
WARNING in ./~/webpack/buildin/global.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* D:\Project\JS\vue-demo\node_modules\webpack\buildin\global.js
Used by 22 module(s), i. e.
D:\Project\JS\vue-demo\node_modules\punycode\punycode.js
* d:\Project\JS\vue-demo\node_modules\webpack\buildin\global.js
Used by 1 module(s), i. e.
d:\Project\JS\vue-demo\node_modules\vue\dist\vue.common.js
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (250 kB).
This can impact web performance.
Assets:
build.js (1.4 MB)
0.cad53edcc50c17b542ba.hot-update.js (1.02 MB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit
(250 kB). This can impact web performance.
Entrypoints:
main (2.42 MB)
build.js
0.cad53edcc50c17b542ba.hot-update.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using System.import() or require.ensure to lazy load some parts of yo
ur application.
For more info visit https://webpack.js.org/guides/code-splitting/
I just npm install & npm run dev
OS: windows10
I use docker in windows, and map my work directory to docter volume. just like:
docker run -it --rm -p 8000:8080 -v C:\mywork:/home/work node:slim bash
In my case, I must add "host" in webpack.config.js to make it work.
devServer: {
host: '0.0.0.0',
...
},
and need remove "--open" options in package.info.
"dev-docker": "cross-env NODE_ENV=development webpack-dev-server --hot",
I just share it for everyone.
i don't understand what i did wrong, i attached my log file' hope you can help me find out the problem.
npm-debug.txt
In Android 4.0.4 webview it shows a blank page
When I add these code as the first child of <body>
, it alerts unexpected strict mode reserved word
<script type="text/javascript">
window.onerror = function(e){
alert(e) // unexpected strict mode reserved word
}
</script>
This problem solved by removing all 'use strict';
I'd like to know if there is another way to solve this problem.
How to remove all console.log running npm run build
I'm trying to load one scss file at App.vue using:
<style src="assets/style.scss" lang="scss"></style>
but i'm getting this error:
./src/App.vue Module not found: Error: Can't resolve 'assets/style.scss'
I have install sass-loader, node-sass, update my npm (4.2.0), node (6.4.0) and the error continues =/
The only change that I've made after install all these libs is add src="assets..." on my App.vue
Tried booting up the base app structure to see it running. Did an npm install, and ran npm run dev; but the webpage it brings up says that it can't reach localhost.
If i run the full webpack, instead of webpack-simple, the same steps bring up a working page.
Am I missing something?
I've written a handful of components, and now I want to publish them to npm, so that I can use my components on separate, unrelated sites.
For simpler components, I know I can just add this to my package.json
:
"main": "src/components/MyComponent.vue",
…but some of my components are comprised of multiple components. I'm pretty sure I could use Vue.extend()
on a "parent" component, but it seems like there would be a better way than that.
I experimented with Browserify, too, and with that I achieved what I wanted by placing this in the file specified by package.json
's main
.
main.js
exports.MyComponentA = require('./components/A.vue');
exports.MyComponentB = require('./components/B.vue');
exports.MyComponentC = require('./components/C.vue');
exports.MyComponentD = require('./components/D.vue');
main.js
var MyComponent = require('vue-hex-accordion');
new Vue({
components: {
MyComponentA: MyComponent.MyComponentA,
MyComponentB: MyComponent.MyComponentB,
MyComponentC: MyComponent.MyComponentC,
MyComponentD: MyComponent.MyComponentD,
}
}
Is there something similar (or better) that can be done with Vue's webpack-simple template?
when npm run dev get error like this:
getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
how can i fix it?
Got the following error when running npm run dev
...node_modules/webpack-dev-server/bin/webpack-dev-server.js:385
throw e;
^
TypeError: webpack.validateSchema is not a function...
Solution: update webpack-dev-server
to ^2.1.0-beta.9
I've started a thread about this on Vue-forum: https://forum.vuejs.org/t/vue-cli-webpack-production-images-vis-icons-are-not-loaded-where-to-import-css/6647/3
I am using Vue-cli [Webpack] and I have installed Vis.js. In App.vue I have added (imported) vis.css:
<style>
@import "../node_modules/vis/dist/vis.css";
...
</style>
When I run npm run dev
- everything works fine, all Vis icons are loaded (displayed), but when I run npm run build
- when I open the app in the browser - Vis icons are missing and I am getting the following errors:
In webpack.config.js when I changed publicPath
from '/dist/'
to './dist/'
- after running the npm run build
command, everything works fine.
Now, I'm not sure whether it is a good idea to have publicPath: './dist/'
by default when we are running only the npm run build
command (and when we run npm run dev
- then it should be just '/dist/'
).
I followed the steps in the README up until "npm run dev". I did not add any extra packages and have the latest version of Node and NPM on OSX 10.10.5. It returns this error output:
> webpackTest@ dev /Users/jason/Sites/webpackTest
> webpack-dev-server --inline --hot
events.js:154
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8080
at Object.exports._errnoException (util.js:890:11)
at exports._exceptionWithHostPort (util.js:913:20)
at Server._listen2 (net.js:1231:14)
at listen (net.js:1267:10)
at net.js:1376:9
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v5.8.0
npm ERR! npm v3.8.2
npm ERR! code ELIFECYCLE
npm ERR! webpackTest@ dev: `webpack-dev-server --inline --hot`
npm ERR! Exit status 1
https://github.com/vuejs-templates/webpack-simple/blob/master/template/src/main.js
What does render: h => h(App)
mean?
vue-cli 起的服务 是localhost:8080 为什么我把localhost 换成我的ip就访问 不了了呢, 访问localhost:8080 就一切正常
Hi,
this code into a vue file :
<style src='module path'></style>
Doesn't work, we get : TypeError: undefined is not an object (evaluating 'e.reduce')
I am using latest webpack-simple with sass.
Any idea ?
It would be better if you used a new syntax, introduced in webpack2 - arrays instead of exclamation mark separated string. It's cleaner, looks more standard (especially for beginners) and it's less error prone.
So instead of:
loaders: {
'scss': 'vue-style-loader!css-loader!sass-loader',
}
Use:
loaders: {
'scss': [
'vue-style-loader',
'css-loader',
'sass-loader'
]
}
I didn't want to rise an issue on this because it could be a local problem and it would be a shame to bother maintainers with this, but couldn't find any similar problem in forums.
I've used this template which worked great locally - kudos for that - but after building and including the dist folder in a repository the router never starts the app and there's no console error either.
Here's the link https://jeremenichelli.github.io/movies/results/vue
Any shed of light is appreciated since I'm planning to write about various frameworks including Vue 😃
13 info lifecycle vuewps@~dev: Failed to exec dev script
14 verbose stack Error: vuewps@ dev: webpack-dev-server --inline --hot
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:852:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid vuewps@
16 verbose cwd d:\WorkDir\vuewps
17 error Windows_NT 6.1.7601
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev"
19 error node v6.3.1
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error vuewps@ dev: webpack-dev-server --inline --hot
22 error Exit status 1
23 error Failed at the vuewps@ dev script 'webpack-dev-server --inline --hot'.
On Mac OSX 10.10.5 Yosemite, npm run dev
does not seem to work. This is an out of the box installation. The Vuejs template "webpack" works just fine. I double checked and nothing else is running on port 8080. Chrome browser shows this:
**The localhost page isn’t working
localhost didn’t send any data.
ERR_EMPTY_RESPONSE**
while the Terminal output from the npm command shows this:
` webTEST@ dev /Users/jason/Sites/webTEST
webpack-dev-server --inline --hot
http://localhost:8080/
webpack result is served from /dist/
content is served from /Users/jason/Sites/webTEST
404s will fallback to /index.html`
webpack-simple/template/src/App.vue
Line 4 in 78a6dbb
<h1>\{{ msg }}</h1>
It could be a local problem but i really can't find the solution for this.
When I init
the project, npm run build
, and click index.html
, everything works fine.
But when I use vue-router
, the browser would throw a error like this:
file:///dist/0.build.js Failed to load resource: net::ERR_FILE_NOT_FOUND
here is my project-tree:
###开发目录 ├── README.md ├── dist // 项目build目录 ├── index.html // 项目入口文件 ├── package.json // 项目配置文件 ├── src // 生产目录 │ ├── views // 各种页面 │ | ├── home.vue │ | ├── blog.vue │ | ├── about.vue │ | └── topic.vue │ | │ ├── components // 各种组件 │ | └── menu.vue │ | │ ├── libs // 工具库 │ | ├── css │ | | └── bootstrap.css │ | └── js │ | └── jquery.js │ | │ ├── assets //静态文件 │ | ├── css │ | | └── index.css │ | ├── scss │ | | └── index.scss │ | ├── js │ | | └── index.js │ | └── images │ | └── index.png │ | │ ├── filters.js // 过滤器 │ ├── routers.js // 路由表 │ └── main.js // Webpack 预编译入口 └── webpack.config.js // Webpack 配置文件
and it works well when I npm run dev
.
Sorry for my poor English.....
I followed the instructions presented to me at several-locations ...
$ npm install -g vue-cli
$ vue init webpack-simple my-project
$ cd my-project
$ npm install
$ npm run dev
and I got this result ...
keywords if/then/else require v5 option
Project is running at http://localhost:8080/
webpack output is served from /dist/
404s will fallback to /index.html
(node:26222) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3
I'm running on ubuntu trusty.
ERROR in ./src/App.vue
Module not found: Error: Cannot resolve module 'D:ProjectName
ode_modules�ue-loaderlibcomponent-normalizer' in D:\ProjectName\src
@ ./src/App.vue 5:16-88
Weird path resolving stuff happens when using this boilerplate on Windows.
I'm using Node v7.3.0.
$ vue init webpack-simple#1.0 my-project
/home/user/.npm-global/lib/node_modules/vue-cli/bin/vue-init:130
var hasDist = JSON.parse(body).some(function (branch) {
^
TypeError: JSON.parse(...).some is not a function
at Request._callback (/home/user/.npm-global/lib/node_modules/vue-cli/bin/vue-init:130:38)
at Request.self.callback (/home/user/.npm-global/lib/node_modules/vue-cli/node_modules/request/request.js:187:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/home/user/.npm-global/lib/node_modules/vue-cli/node_modules/request/request.js:1044:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/home/user/.npm-global/lib/node_modules/vue-cli/node_modules/request/request.js:965:12)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Anyone done this successfully?
This is not working for me.
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: ExtractTextPlugin.extract('css!sass')
}
]
},
plugins: [
new ExtractTextPlugin('style.scss')
]
[HMR] Waiting for update signal from WDS...
build.js:1256 Uncaught Error: Cannot find module "./src/main.js"
at webpackMissingModule (build.js:1256)
at Object. (build.js:1256)
at webpack_require (build.js:658)
at build.js:705
at build.js:708
webpackMissingModule @ build.js:1256
(anonymous) @ build.js:1256
webpack_require @ build.js:658
(anonymous) @ build.js:705
(anonymous) @ build.js:708
client?20ba:38 [WDS] Hot Module Replacement enabled.
client?20ba:38 [WDS] Errors while compiling.
client?20ba:80 multi main
Module not found: Error: Can't resolve 'babel' in 'F:\myfuture\zbc'
resolve 'babel' in 'F:\myfuture\zbc'
Parsed request is a module
using description file: F:\myfuture\zbc\package.json (relative path: .)
after using description file: F:\myfuture\zbc\package.json (relative path: .)
resolve as module
F:\myfuture\node_modules doesn't exist or is not a directory
F:\node_modules doesn't exist or is not a directory
looking for modules in F:\myfuture\zbc\node_modules
using description file: F:\myfuture\zbc\package.json (relative path: ./node_modules)
after using description file: F:\myfuture\zbc\package.json (relative path: ./node_modules)
using description file: F:\myfuture\zbc\package.json (relative path: ./node_modules/babel)
as directory
F:\myfuture\zbc\node_modules\babel doesn't exist
no extension
F:\myfuture\zbc\node_modules\babel doesn't exist
.js
F:\myfuture\zbc\node_modules\babel.js doesn't exist
.json
F:\myfuture\zbc\node_modules\babel.json doesn't exist
[F:\myfuture\node_modules]
[F:\node_modules]
[F:\myfuture\zbc\node_modules\babel]
[F:\myfuture\zbc\node_modules\babel]
[F:\myfuture\zbc\node_modules\babel.js]
[F:\myfuture\zbc\node_modules\babel.json]
@ multi main
errors @ client?20ba:80
sock.onmessage @ socket.js?e5d0:37
EventTarget.dispatchEvent @ eventtarget.js?a091:51
(anonymous) @ main.js?75ae:274
SockJS._transportMessage @ main.js?75ae:272
EventEmitter.emit @ emitter.js?d38a:50
WebSocketTransport.ws.onmessage @ websocket.js?5d51:35
执行npm run dev 报错~! 命令行报Module not found: Error: Can't resolve 'babel' in 'F:\myfuture\zbc' 可是babel已全局安装。
I'm getting this error on Fedora 23 by following the steps included in the template's readme. I will paste the complete log created by npm run dev
below because honestly I have absolutely no idea what I'm doing (this is my first dive into JavaScript/npm land). Any help is very appreciated and I'd be grateful to help debugging this issue.
[embik@fedorabook example-project]$ npm run dev
> example-project@ dev /home/embik/Projekte/example-project
> webpack-dev-server --inline --hot
http://localhost:8080/
webpack result is served from /dist/
content is served from /home/embik/Projekte/example-project
404s will fallback to /index.html
Hash: 3922b4e8c9e95ef1ac18
Version: webpack 1.12.14
Time: 7462ms
Asset Size Chunks Chunk Names
build.js 1.35 MB 0 [emitted] main
chunk {0} build.js (main) 475 kB [rendered]
[0] multi main 52 bytes {0} [built]
[1] (webpack)-dev-server/client?http://localhost:8080 2.67 kB {0} [built]
[2] (webpack)/~/node-libs-browser/~/url/url.js 22.3 kB {0} [built]
[3] (webpack)/~/node-libs-browser/~/url/~/punycode/punycode.js 14.6 kB {0} [built]
[4] (webpack)/buildin/module.js 251 bytes {0} [built]
[5] (webpack)/~/node-libs-browser/~/url/~/querystring/index.js 127 bytes {0} [built]
[6] (webpack)/~/node-libs-browser/~/url/~/querystring/decode.js 2.4 kB {0} [built]
[7] (webpack)/~/node-libs-browser/~/url/~/querystring/encode.js 2.09 kB {0} [built]
[8] (webpack)-dev-server/~/sockjs-client/lib/entry.js 244 bytes {0} [built]
[9] (webpack)-dev-server/~/sockjs-client/lib/transport-list.js 613 bytes {0} [built]
[10] (webpack)-dev-server/~/sockjs-client/lib/transport/websocket.js 2.68 kB {0} [built]
[11] (webpack)/~/node-libs-browser/~/process/browser.js 2.06 kB {0} [built]
[12] (webpack)-dev-server/~/sockjs-client/lib/utils/event.js 2 kB {0} [built]
[13] (webpack)-dev-server/~/sockjs-client/lib/utils/random.js 746 bytes {0} [built]
[14] (webpack)-dev-server/~/sockjs-client/lib/utils/browser-crypto.js 438 bytes {0} [built]
[15] (webpack)-dev-server/~/sockjs-client/lib/utils/url.js 975 bytes {0} [built]
[16] (webpack)-dev-server/~/sockjs-client/~/url-parse/index.js 6.55 kB {0} [built]
[17] (webpack)-dev-server/~/sockjs-client/~/url-parse/~/requires-port/index.js 753 bytes {0} [built]
[18] (webpack)-dev-server/~/sockjs-client/~/url-parse/lolcation.js 1.4 kB {0} [built]
[19] (webpack)-dev-server/~/sockjs-client/~/url-parse/~/querystringify/index.js 1.3 kB {0} [built]
[20] (webpack)-dev-server/~/sockjs-client/~/debug/browser.js 3.76 kB {0} [built]
[21] (webpack)-dev-server/~/sockjs-client/~/debug/debug.js 4.1 kB {0} [built]
[22] (webpack)-dev-server/~/sockjs-client/~/debug/~/ms/index.js 2.33 kB {0} [built]
[23] (webpack)-dev-server/~/sockjs-client/~/inherits/inherits_browser.js 672 bytes {0} [built]
[24] (webpack)-dev-server/~/sockjs-client/lib/event/emitter.js 1.11 kB {0} [built]
[25] (webpack)-dev-server/~/sockjs-client/lib/event/eventtarget.js 1.75 kB {0} [built]
[26] (webpack)-dev-server/~/sockjs-client/lib/transport/browser/websocket.js 58 bytes {0} [built]
[27] (webpack)-dev-server/~/sockjs-client/lib/transport/xhr-streaming.js 1.25 kB {0} [built]
[28] (webpack)-dev-server/~/sockjs-client/lib/transport/lib/ajax-based.js 1.31 kB {0} [built]
[29] (webpack)-dev-server/~/sockjs-client/lib/transport/lib/sender-receiver.js 1.15 kB {0} [built]
[30] (webpack)-dev-server/~/sockjs-client/lib/transport/lib/buffered-sender.js 2.3 kB {0} [built]
[31] (webpack)-dev-server/~/sockjs-client/lib/transport/lib/polling.js 1.32 kB {0} [built]
[32] (webpack)-dev-server/~/sockjs-client/lib/transport/receiver/xhr.js 1.58 kB {0} [built]
[33] (webpack)-dev-server/~/sockjs-client/lib/transport/sender/xhr-cors.js 343 bytes {0} [built]
[34] (webpack)-dev-server/~/sockjs-client/lib/transport/browser/abstract-xhr.js 4.67 kB {0} [built]
[35] (webpack)-dev-server/~/sockjs-client/lib/transport/sender/xhr-local.js 352 bytes {0} [built]
[36] (webpack)-dev-server/~/sockjs-client/lib/utils/browser.js 560 bytes {0} [built]
[37] (webpack)-dev-server/~/sockjs-client/lib/transport/xdr-streaming.js 984 bytes {0} [built]
[38] (webpack)-dev-server/~/sockjs-client/lib/transport/sender/xdr.js 2.42 kB {0} [built]
[39] (webpack)-dev-server/~/sockjs-client/lib/transport/eventsource.js 766 bytes {0} [built]
[40] (webpack)-dev-server/~/sockjs-client/lib/transport/receiver/eventsource.js 1.58 kB {0} [built]
[41] (webpack)-dev-server/~/sockjs-client/lib/transport/browser/eventsource.js 37 bytes {0} [built]
[42] (webpack)-dev-server/~/sockjs-client/lib/transport/lib/iframe-wrap.js 981 bytes {0} [built]
[43] (webpack)-dev-server/~/sockjs-client/lib/transport/iframe.js 3.8 kB {0} [built]
[44] (webpack)-dev-server/~/sockjs-client/~/json3/lib/json3.js 43.3 kB {0} [built]
[45] (webpack)/buildin/amd-options.js 43 bytes {0} [built]
[46] (webpack)-dev-server/~/sockjs-client/lib/version.js 25 bytes {0} [built]
[47] (webpack)-dev-server/~/sockjs-client/lib/utils/iframe.js 4.95 kB {0} [built]
[48] (webpack)-dev-server/~/sockjs-client/lib/utils/object.js 532 bytes {0} [built]
[49] (webpack)-dev-server/~/sockjs-client/lib/transport/htmlfile.js 710 bytes {0} [built]
[50] (webpack)-dev-server/~/sockjs-client/lib/transport/receiver/htmlfile.js 2.17 kB {0} [built]
[51] (webpack)-dev-server/~/sockjs-client/lib/transport/xhr-polling.js 894 bytes {0} [built]
[52] (webpack)-dev-server/~/sockjs-client/lib/transport/xdr-polling.js 712 bytes {0} [built]
[53] (webpack)-dev-server/~/sockjs-client/lib/transport/jsonp-polling.js 1.02 kB {0} [built]
[54] (webpack)-dev-server/~/sockjs-client/lib/transport/receiver/jsonp.js 5.49 kB {0} [built]
[55] (webpack)-dev-server/~/sockjs-client/lib/transport/sender/jsonp.js 2.46 kB {0} [built]
[56] (webpack)-dev-server/~/sockjs-client/lib/main.js 11.9 kB {0} [built]
[57] (webpack)-dev-server/~/sockjs-client/lib/shims.js 18.2 kB {0} [built]
[58] (webpack)-dev-server/~/sockjs-client/lib/utils/escape.js 2.31 kB {0} [built]
[59] (webpack)-dev-server/~/sockjs-client/lib/utils/transport.js 1.35 kB {0} [built]
[60] (webpack)-dev-server/~/sockjs-client/lib/utils/log.js 386 bytes {0} [built]
[61] (webpack)-dev-server/~/sockjs-client/lib/event/event.js 485 bytes {0} [built]
[62] (webpack)-dev-server/~/sockjs-client/lib/location.js 177 bytes {0} [built]
[63] (webpack)-dev-server/~/sockjs-client/lib/event/close.js 295 bytes {0} [built]
[64] (webpack)-dev-server/~/sockjs-client/lib/event/trans-message.js 292 bytes {0} [built]
[65] (webpack)-dev-server/~/sockjs-client/lib/info-receiver.js 2.22 kB {0} [built]
[66] (webpack)-dev-server/~/sockjs-client/lib/transport/sender/xhr-fake.js 456 bytes {0} [built]
[67] (webpack)-dev-server/~/sockjs-client/lib/info-iframe.js 1.52 kB {0} [built]
[68] (webpack)-dev-server/~/sockjs-client/lib/info-iframe-receiver.js 791 bytes {0} [built]
[69] (webpack)-dev-server/~/sockjs-client/lib/info-ajax.js 1.03 kB {0} [built]
[70] (webpack)-dev-server/~/sockjs-client/lib/iframe-bootstrap.js 2.9 kB {0} [built]
[71] (webpack)-dev-server/~/sockjs-client/lib/facade.js 723 bytes {0} [built]
[72] (webpack)-dev-server/~/strip-ansi/index.js 161 bytes {0} [built]
[73] (webpack)-dev-server/~/strip-ansi/~/ansi-regex/index.js 135 bytes {0} [built]
[74] (webpack)/hot/dev-server.js 1.85 kB {0} [built]
[75] (webpack)/hot/log-apply-result.js 813 bytes {0} [built]
[76] ./src/main.js 334 bytes {0} [built]
[77] ./~/vue/dist/vue.common.js 245 kB {0} [built]
[78] ./src/App.vue 1.36 kB {0} [built]
[79] ./~/vue-style-loader!./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js!./~/vue-loader/lib/selector.js?type=style&index=0!./src/App.vue 1.28 kB {0} [built] [1 error]
[81] ./~/vue-style-loader/addStyles.js 6.24 kB {0} [built]
[82] ./~/babel-loader?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue 176 bytes {0} [built]
[83] ./~/vue-html-loader!./~/vue-loader/lib/selector.js?type=template&index=0!./src/App.vue 70 bytes {0} [built]
[84] ./~/vue-hot-reload-api/index.js 6.96 kB {0} [built]
ERROR in ./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js!./~/vue-loader/lib/selector.js?type=style&index=0!./src/App.vue
Module build failed: ReferenceError: Promise is not defined
at LazyResult.async (/home/embik/Projekte/example-project/node_modules/vue-loader/node_modules/postcss/lib/lazy-result.js:157:31)
at LazyResult.then (/home/embik/Projekte/example-project/node_modules/vue-loader/node_modules/postcss/lib/lazy-result.js:79:21)
at Object.module.exports (/home/embik/Projekte/example-project/node_modules/vue-loader/lib/style-rewriter.js:88:6)
@ ./~/vue-style-loader!./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js!./~/vue-loader/lib/selector.js?type=style&index=0!./src/App.vue 4:14-199 13:2-17:4 14:20-205
Hello,
with ES lint / Airbnb styleguide, the App.vue template makes an unexpected token
error on the {
on the second line:
export default {
data () {
return {
…
}
}
}
How is it possible to avoid this?
Thank you
airbnb/javascript#947
publicPath:'/dist/' 在 npm run build 后,img.src有问题
after clean install and run
npm run dev
or
npm run build
following issue
ERROR in ./~/vue/dist/vue.js
Module not found: Error: Can't resolve 'he' in 'test\node_modules\vue\dist'
@ ./~/vue/dist/vue.js 5762:11-24
@ ./src/main.js
@ multi main
The demo 'Welcome Site' is working.
The README states:
Note this template is not suitable for production - for that you may want to wait for an official 2.0 webpack template.
Is that statement still true? What is the recommended alternative for a webpack/loader based Vue project? vue-loader just points to this repo. Is vuejs-templates/webpack the most appropriate starting point for projects intended for production?
Hi,
When I put assets in the assets
folder and reference them like
<a href="./assets/sound.mp3">sound file</a>
they don't convert in build (to /build/sound.mp3?8273t83rt72tr3etc
).
Instead, I get a "cannot GET [file]" warning printed to screen.
I tried reconfiguring vue-loader but nothing seemed to work.
For example, I tried placing mp3 in
{
test: /\.(png|jpg|gif|svg|mp3)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
but this only helps me make dist src
paths for images to mp3 files, which obviously isn't what I want 😆.
Sorry if this is a silly question 😬
After a fresh install this error pops up when you npm run dev
.
TypeError: webpack.validateSchema is not a function
> cross-env NODE_ENV=production webpack --progress --hide-modules
Hash: df1b034b1e5d8233d20f
Version: webpack 2.1.0-beta.21
Time: 5087ms
Asset Size Chunks Chunk Names
build.js 50.1 kB 0 [emitted] main
ERROR in ./src/App.vue
Module build failed: /home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/vue-loader/lib/parser.js:25
output.styles.forEach(style => {
^^
SyntaxError: Unexpected token =>
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/vue-loader/lib/loader.js:3:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/vue-loader/index.js:1:80)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at loadLoader (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/node_modules/loader-runner/lib/loadLoader.js:13:17)
at iteratePitchingLoaders (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:140:2)
at runLoaders (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:326:2)
at NormalModule.doBuild (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/lib/NormalModule.js:125:2)
at NormalModule.build (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/lib/NormalModule.js:173:15)
at Compilation.buildModule (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/lib/Compilation.js:127:9)
at /home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/lib/Compilation.js:303:10
at /home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/lib/NormalModuleFactory.js:63:13
at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test/node_modules/webpack/node_modules/tapable/lib/Tapable.js:123:70)
@ ./src/main.js 2:0-28
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info prebuild test@
6 info build test@
7 verbose unsafe-perm in lifecycle true
8 info test@ Failed to exec build script
9 verbose stack Error: test@ build: `cross-env NODE_ENV=production webpack --progress --hide-modules`
9 verbose stack Exit status 2
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:829:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid test@
11 verbose cwd /home/gaoxiang/projects/lwwl/micro-cms/public/lwwl/front-end/back-end/test
12 error Linux 4.4.0-34-generic
13 error argv "/usr/bin/nodejs" "/usr/local/bin/npm" "run" "build"
14 error node v4.5.0
15 error npm v2.15.1
16 error code ELIFECYCLE
17 error test@ build: `cross-env NODE_ENV=production webpack --progress --hide-modules`
17 error Exit status 2
18 error Failed at the test@ build script 'cross-env NODE_ENV=production webpack --progress --hide-modules'.
18 error This is most likely a problem with the test package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error cross-env NODE_ENV=production webpack --progress --hide-modules
18 error You can get information on how to open an issue for this project with:
18 error npm bugs test
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls test
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
Running NPM v3.9.5 on under Node 6.2.2 and Vue-cli 2.1.1 and installing webpack via vue init webpack
running npm run dev
doesn't transpile correctly, opening the output in chrome results in Uncaught SyntaxError: Unexpected token import
.babelrc
{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"],
"comments": false
}
EDIT: Windows 10
The webpack config mentions scss and sass loaders for the .vue files, but the package.json does not mention it.
Installed node-sass and sass-loader to solve a <style lang="scss">
in a vue component, although I don't know if that's the correct solution (beginner here).
$ npm install node-sass --save-dev
$ npm install sass-loader --save-dev
It may seem obvious but it's not to me. For example I wonder if there are smaller packages to keep node_modules/ as lean as possible, since I only use sass/scss in vue files atm. I am also wondering if it's my config which is faulty causing webpack to fail (perhaps something else can handle sass?).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.