vue cli3搭建的项目里使用axios引入本地json一直404

json文件我存在在public文件夹下,我记得不错的话,cli3之后public才是存放静态资源的地方,而不是之前的static了吧,但是不知道为什么还是报404,是我还得在vue.config.js中配置什么吗图片说明

  methods:{
    send(){
      axios.get('/public/student.json',{}).then(res=>{console.log(res.data)})
    }
  },
  mounted(){
    this.send()
  }

3个回答

直接写axios.get('/student.json',{}) 即可图片说明

缺少目录与js文件 src="//目录路径/名字.js"

JXH765
JXH765 额 这个需要js文件干什么
大约一年之前 回复

/ 直接指向项目下的public文件夹, 而不是你的项目, 所以直接访问public下的文件夹即可

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
vue-cli(目前使用的是4.2.3)axios get方法获取json404错误?

本人前端初学者 在使用vue-cli(目前使用的是4.2.3)写代码时,遇到了这样的问题: 使用axios的get方法获取本地的json文件总是报404错误,获取外网可以获取到。 网上找了大堆相关问题,有的说是放在src/static目录下,然后使用相对路径访问就可以,我测试了,还是一样的404错误。 的说是放在public下,然后使用绝对路径访问,结果还是404错误。 后来我去了看了官方文档,只有说相对路径和绝对路径的问题。无奈,再次懵逼了。 后来看到有的说是映射,这我就更懵逼了。 求大佬来帮忙解决

求大神帮忙解决:vue-cli3 axios请求本地数据问题

引入axios ``` import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import axios from 'axios' Vue.config.productionTip = false Vue.prototype.$axios = axios ``` vue.config.js ``` module.exports = { devServer: { open: true, host: 'localhost', port: 8080, https: false, hotOnly: false, proxy: { // 配置跨域 '/api': { target: 'http://localhost:8080', ws: true, changOrigin: true, pathRewrite: { '^/api': '' } } }, before: app => {} } }; ``` json目录 ![图片说明](https://img-ask.csdn.net/upload/201908/22/1566447518_763675.png) axios请求 ``` getData() { this.$axios('api/data/profile/shopping.json') .then( res => { console.log(res.data) }) } ``` 错误提示 ![图片说明](https://img-ask.csdn.net/upload/201908/22/1566447555_906674.png)

vue使用axios获取接口数据如何封装?

我是一个刚用vue的小菜鸟,使用axios请求接口,想将获取的数据封装到页面上的dataList属性里,可是页面报错了 import MD5 from '../assets/js/MD5Util.js'; export default { name: 'awardVue', data () { return { dataList:[], str:"" } }, mounted :function(){ this.getData(); }, methods:{ getData(){ const param=MD5.getPkey(1,10); this.$http.get('apis/school/grasslandTransfer/winningStatisticsList', { params:{ startNum: '1', endNum: '10', version: param.version, platformSource: param.platformSource, time: param.time, ltime: param.ltime, pkey: param.pkey } }) .then(function (response) { console.log(response.data); this.dataList=response.data.winningStatisticsList; }) .catch(function (error) { console.log(error); }); } } } 这是返回的结果 Object {msg: "查询成功", code: "1", winningStatisticsList: Array(10)} award.vue?e9e3:51 TypeError: Cannot set property 'dataList' of undefined at eval (award.vue?e9e3:48) at <anonymous> 可是response.data明明是有数据的啊,json格式,为什么会显示为undefined呢?

vuecli3,axios发送一个请求到后端,后端录入两条数据,是哪里出了问题

### 场景问题描述: - vue的axios请求,同样的代码,发送给thinkphp6,数据库录入是一条 发送给thinkphp5,数据库录入是两条,第一条是空白的,第二条是真实的 浏览器是发起一个请求的 - 浏览器截图 ![图片说明](https://img-ask.csdn.net/upload/202005/07/1588814625_796566.jpg) ``` // 对接tp6后端的写法 // vue代码 var data = { title: '模板22', colors: '{"0":"蓝色"}', number: 11 } axios.post('/api/adminmb/Productlist/create', data) .then(function(response) { console.log(response) }) .catch(function(error) { console.log(error) }) // thinkphp6代码 //控制器 public function create() { $data = Request::param(); $res = Product::createDo($data); if ($res) { return self::returnMsg(200, 'success',$data); } else { return self::returnMsg(401, 'fail',$data); } } //模型 public static function createDo($data) { if(!empty($data['id'])){ $result = Product::update($data,['id'=>$data['id']]); }else{ $result = Product::create($data); } return $result; } 结果是录入正常的一条数据 ``` ``` //对接tp5的写法 //vue代码 var data = { title: '模板22', colors: '{"0":"蓝色"}', number: 11 } axios.post('/api/adminmb/Productlist/create', data) .then(function(response) { console.log(response) }) .catch(function(error) { console.log(error) }) //thinkphp5写法 //控制器 public function create() { $data = $_POST; $CrmProduct = new CrmProduct(); $CrmProduct->allowField(true)->save($data); $this->return_res($data); } 结果是录入两条数据,第一条是空白的,第二条是真实的 ``` - 数据库截图 ![图片说明](https://img-ask.csdn.net/upload/202005/07/1588783846_832935.jpg) - 服务器用Nginx,跨域解决: ``` set $cors_origin ""; if ($http_origin ~* "^http://localhost:8080$") { set $cors_origin $http_origin; } add_header Access-Control-Allow-Origin $cors_origin; add_header Access-Control-Allow-Headers X-Requested-With,X-Token,Content-Type,Accept,Origin; add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE; ``` - 排查方案 1、用apipost工具接口录入后端,测试正常,录入一条数据 2、用jQuery的写法录入后端,测试正常,录入一条数据 - apipost工具截图 ![图片说明](https://img-ask.csdn.net/upload/202005/07/1588784243_135366.jpg) - jQuery写法代码 ``` <script typet="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> <script> $(document).ready(function (e) { var data = { title: '模板22', colors: '{"0":"蓝色"}', number: 11 } var url='/api/adminmb/Productlist/create'; $.ajax({ type: 'POST', url: url, dataType: 'json', data: data, success: function (response, status) { if(response.code){ //获取数据成功 alert(response.data.title); }else{ //返回错误数据 alert(response.data); } }, error:function(xhr,status,error){ //返回数据异常 alert('返回数据异常!'); } }); }); </script> ```

关于vue的cli里面package.json文件?

求大神指教一下这里面的东西都是啥?特别是scripts里面的,我发现我家里电脑的scripts里面的东西跟公司里scripts里面的东西是不一样的? ``` { "name": "zhiliao.0", "version": "1.0.0", "description": "A Vue.js project", "author": "momo <552488648@qq.com>", "private": true, "scripts": { "dev": "node build/dev-server.js", "build": "npm run build-prod", "start": "cross-env node build/webpack.dll.js && cross-env TYPE=local node build/dev-server.js", "start-dev": "node build/webpack.dll.js && cross-env TYPE=dev node build/dev-server.js", "start-test": "node build/webpack.dll.js && cross-env TYPE=test node build/dev-server.js", "start-prod": "node build/webpack.dll.js && cross-env TYPE=prod node build/dev-server.js", "build-local": "cross-env TYPE=local model=dev node build/webpack.dll.js && cross-env TYPE=local node build/build.js", "build-dev": "cross-env TYPE=dev model=build node build/webpack.dll.js && cross-env TYPE=dev node build/build.js", "build-test": "cross-env TYPE=test model=build node build/webpack.dll.js && cross-env TYPE=test node build/build.js", "build-prod": "cross-env TYPE=prod model=build node build/webpack.dll.js && cross-env TYPE=prod node build/build.js" }, "dependencies": { "axios": "^0.15.3", "blueimp-md5": "^2.7.0", "es6-promise": "^4.1.0", "mint-ui": "^2.2.1", "qs": "^6.4.0", "vue": "^2.2.2", "vue-baidu-map": "^0.10.5", "vue-router": "^2.2.0", "vuex": "^2.2.1", "weixin-js-sdk": "^1.2.0" }, "devDependencies": { "add-asset-html-webpack-plugin": "^2.1.2", "autoprefixer": "^6.7.2", "babel-core": "^6.22.1", "babel-eslint": "^8.0.3", "babel-loader": "^6.2.10", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-runtime": "^6.22.0", "babel-plugin-transform-vue-jsx": "^3.5.0", "babel-preset-env": "^1.2.1", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-2": "^6.22.0", "babel-register": "^6.22.0", "babel-runtime": "^6.26.0", "chalk": "^1.1.3", "connect-history-api-fallback": "^1.3.0", "copy-webpack-plugin": "^4.0.1", "cross-env": "^5.1.1", "css-loader": "^0.26.4", "eslint": "4.4.1", "eslint-config-standard": "10.2.1", "eslint-friendly-formatter": "3.0.0", "eslint-loader": "1.9.0", "eslint-plugin-html": "3.1.1", "eslint-plugin-import": "2.7.0", "eslint-plugin-node": "5.1.1", "eslint-plugin-promise": "3.5.0", "eslint-plugin-standard": "3.0.1", "eventsource-polyfill": "^0.9.6", "express": "^4.14.1", "extract-text-webpack-plugin": "^2.0.0", "file-loader": "^0.10.0", "form-data": "^0.2.0", "friendly-errors-webpack-plugin": "^1.1.3", "function-bind": "^1.1.0", "happypack": "^4.0.0", "html-webpack-plugin": "^2.28.0", "http-proxy-middleware": "^0.17.3", "iconv-lite": "^0.4.7", "mime": "~1.3.4", "node-sass": "^4.9.3", "opn": "^4.0.2", "optimize-css-assets-webpack-plugin": "^1.3.0", "ora": "^1.3.0", "portfinder": "^1.0.13", "request": "~2.72.0", "rimraf": "^2.6.0", "sass-loader": "^6.0.6", "semver": "^5.3.0", "shelljs": "^0.8.1", "url-loader": "^0.5.7", "urlencode": "^1.1.0", "verification-code": "^1.0.0", "vue-loader": "^11.1.4", "vue-style-loader": "^2.0.5", "vue-template-compiler": "^2.2.4", "webpack": "^2.2.1", "webpack-bundle-analyzer": "^2.2.1", "webpack-dev-middleware": "^1.10.0", "webpack-hot-middleware": "^2.16.1", "webpack-merge": "^2.6.1", "webpack-parallel-uglify-plugin": "^1.0.2", "workbox-webpack-plugin": "^2.1.2", "ws": "^0.4.32" }, "engines": { "node": ">= 4.0.0", "npm": ">= 3.0.0" }, "publishConfig": { "registry": "http://registry.npm.alibaba-inc.com" }, "browserslist": [ "> 1%", "last 2 versions", "not ie <= 8" ] } ```

vue打包后static下的json文件没有单独出现,打包后的文件可以正常运行,我想打包后可以修改这个文件

const resolve = require("path").resolve; var webpack = require('webpack') const HtmlWebpackPlugin = require("html-webpack-plugin"); module.exports = { entry:{ app: './src/main.js' }, output: { path: resolve(__dirname, './dist'), publicPath: process.env.NODE_ENV != 'production' ?'':'./', chunkFilename: "CWL_[id].js?[chunkhash]", filename: process.env.NODE_ENV === 'production' ? "[name].js?[chunkhash]" : "[name].js", }, module: { rules: [ { test: /\.css$/, use: [ 'vue-style-loader', 'css-loader' ] }, { test: /\.less$/, use:['style-loader','css-loader','less-loader'] }, { test: /\.vue$/, loader: 'vue-loader', options: { loaders: { } // other vue-loader options go here } }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } } ] }, plugins: [ // new webpack.optimize.CommonsChunkPlugin({ // names: ["vendor", "manifest"] // }), new HtmlWebpackPlugin({ template: "index.html",favicon:'static/favicon.ico' }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), ], resolve: { alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), }, extensions: ['*', '.js', '.vue', '.json'] }, devServer: { port:9889, host:'192.168.50.107', proxy: { '/api/': { target: '', changeOrigin: true, pathRewrite: { '^/api': '' } } }, }, performance: { hints: false }, devtool: process.env.NODE_ENV != 'production'? "#eval-source-map" : "#source" } ![图片说明](https://img-ask.csdn.net/upload/201904/18/1555581901_396467.jpg)

vue设置proxy代理解决跨域问题出现500

我设置的proxy![图片说明](https://img-ask.csdn.net/upload/201910/06/1570329730_529659.png) 不同环境配置url![图片说明](https://img-ask.csdn.net/upload/201910/06/1570329770_136012.png) 设置axios.defaults.baseURL![图片说明](https://img-ask.csdn.net/upload/201910/06/1570329808_586419.png) 访问接口![图片说明](https://img-ask.csdn.net/upload/201910/06/1570329842_125795.png) 500错误![图片说明](https://img-ask.csdn.net/upload/201910/06/1570329892_770793.png) 问题已解决,问题不在proxy,而是axios.post发送数据要转换成json格式。var data = JSON.stringify(msg)

如何将 package.json 中的每个依赖更新为最新版本?

<div class="post-text" itemprop="text"> <p>I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don't mind fixing something if it breaks.</p> <p>What's the easiest way to do this?</p> <p>The best way I know of now is to run <code>npm info express version</code> then update package.json manually for each one. There must be a better way.</p> <pre><code>{ "name": "myproject", "description": "my node project", "version": "1.0.0", "engines": { "node": "0.8.4", "npm": "1.1.65" }, "private": true, "dependencies": { "express": "~3.0.3", // how do I get these bumped to latest? "mongodb": "~1.2.5", "underscore": "~1.4.2", "rjs": "~2.9.0", "jade": "~0.27.2", "async": "~0.1.22" } } </code></pre> <hr> <p>I am now a collaborator on <a href="https://github.com/tjunnone/npm-check-updates" rel="noreferrer">npm-check-updates</a>, which is a great solution to this problem.</p> </div> <p>转载于:https://stackoverflow.com/questions/16073603/how-do-i-update-each-dependency-in-package-json-to-the-latest-version</p>

Laravel 5.7 - 广播 - socket.io - redis:客户端什么也没发生

<div class="post-text" itemprop="text"> <p>Since few days I read about how to setup laravel-echo on my local machine. I manage to be able to run laravel-echo-server with redis and socket.io.</p> <p>The problem is that the event is fired, but nothing happen on the client side.</p> <p>I know that the event is fired, because it's log into my horizon.log file.</p> <pre><code>Horizon started successfully. [2018-08-29 18:35:30][31] Processing: App\Events\NewModel [2018-08-29 18:35:31][31] Processed: App\Events\NewModel </code></pre> <p>Then, into my echo.log file, I can see that the user is connected to the channel and echo trigger the event.</p> <pre><code>L A R A V E L E C H O S E R V E R version 1.3.9 ⚠ Starting server in DEV mode... ✔ Running at localhost on port 60010 ✔ Channels are ready. ✔ Listening for http events... ✔ Listening for redis events... Server ready! [6:35:15 PM] - QW3VITRzWPH4FvxPAAAB joined channel: channel-name Channel: presence-channel-name Event: App\Events\NewModel </code></pre> <p>It run on port 60010, because when I tried to do it on port 6001, the client is unable to connect.</p> <p>I'm using virtualbox/homestead on a windows 10 machine.</p> <p>There is the port forwarding into my Homestead.yaml</p> <pre><code>ports: - send: 60010 to: 6001 </code></pre> <p>So, I don't understand why client don't log the event. There is why my code at the moment</p> echo.js <pre><code>/** * Echo exposes an expressive API for subscribing to channels and listening * for events that are broadcast by Laravel. Echo and event broadcasting * allows your team to easily build robust real-time web applications. */ import Echo from "laravel-echo" window.io = require('socket.io-client'); // Have this in case you stop running your laravel echo server if (typeof io !== 'undefined') { window.Echo = new Echo({ broadcaster: 'socket.io', host: window.location.hostname + ':60010', }); console.log('Connected to socket.io'); } else { console.log('Not connected to socket.io'); } window.Echo.channel('channel-name') .listen('NewModel', (e) =&gt; { console.log('1:'); console.log(e); }) .listen('App\Events\NewModel', (e) =&gt; { console.log('2:'); console.log(e); }) .listen('App.Events.NewModel', (e) =&gt; { console.log('3:'); console.log(e); }); </code></pre> laravel-echo-server.json <pre><code>{ "authHost": "https://app.torque.homestead", "authEndpoint": "/broadcasting/auth", "clients": [{ "appId": "appId", "key": "key" }], "database": "redis", "databaseConfig": { "redis": { "port": "6379", "host": "127.0.0.1" }, "sqlite": { "databasePath": "/database/laravel-echo-server.sqlite" } }, "devMode": true, "host": "", "port": "60010", "protocol": "https", "socketio": {}, "sslCertPath": "app.torque.homestead.crt", "sslKeyPath": "app.torque.homestead.key", "sslCertChainPath": "", "sslPassphrase": "", "apiOriginAllow": { "allowCors": false, "allowOrigin": "", "allowMethods": "", "allowHeaders": "" } } </code></pre> channels.php <pre><code>&lt;?php /* |-------------------------------------------------------------------------- | Broadcast Channels |-------------------------------------------------------------------------- | | Here you may register all of the event broadcasting channels that your | application supports. The given channel authorization callbacks are | used to check if an authenticated user can listen to the channel. | */ Broadcast::channel('App.User.{id}', function ($user, $id) { return (int) $user-&gt;id === (int) $id; }); Broadcast::channel('channel-name', function () { return true; }); </code></pre> <p>If you want to see another file, let me know. Actually I don't know what could be needed to fix the issue.</p> <p>I think the problem may come from the forwarding port... But like I said, using 6001 is not working.</p> <p>I tried many things like changing port(maybe not the right combination like client on 60010 and server on 6001????)</p> <p>I also change that line into echo.js many times</p> <pre><code>host: window.location.hostname + ':60010', </code></pre> <p>There is some version of what i'm using :</p> <pre><code>vagrant@homestead:~$ node -v v10.8.0 vagrant@homestead:~$ npm -v 6.4.0 vagrant@homestead:~$ php -v PHP 7.2.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:54) ( NTS ) </code></pre> <p>packages.json</p> <pre><code>{ "private": true, "scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "npm run development -- --watch", "watch-poll": "npm run watch -- --watch-poll", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.18", "babel-preset-react": "^6.24.1", "bootstrap": "^4.1.3", "cross-env": "^5.2.0", "jquery": "^3.2", "laravel-mix": "^2.1.14", "lodash": "^4.17.4", "popper.js": "^1.14.4", "vue": "^2.5.17" }, "dependencies": { "@fortawesome/fontawesome": "^1.1.8", "@fortawesome/fontawesome-free-brands": "^5.0.13", "@fortawesome/fontawesome-free-regular": "^5.0.13", "@fortawesome/fontawesome-free-solid": "^5.0.13", "@fortawesome/fontawesome-free-webfonts": "^1.0.9", "@fortawesome/vue-fontawesome": "0.0.22", "ajv": "^6.5.3", "bootstrap-confirmation2": "^4.0.1", "datatables.net": "^1.10.19", "datatables.net-bs4": "^1.10.19", "datatables.net-buttons": "^1.5.3", "datatables.net-buttons-bs4": "^1.5.3", "express": "^4.16.3", "ioredis": "^4.0.0", "laravel-echo": "^1.4.0", "laravel-echo-server": "^1.3.9", "socket.io": "^2.1.1", "socket.io-client": "^2.1.1", "vee-validate": "^2.0.9", "vue-inject": "^2.1.1", "yarn": "^1.9.4" } } </code></pre> <p>composer.json</p> <pre><code>{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": "^7.1.3", "aloha/twilio": "^4.0", "eyewitness/eye": "dev-beta", "fideloper/proxy": "^4.0", "guzzlehttp/guzzle": "^6.3", "laravel/framework": "5.7.*", "laravel/horizon": "^1.3", "laravel/passport": "^6.0", "laravel/tinker": "^1.0", "predis/predis": "^1.1" }, "require-dev": { "filp/whoops": "^2.0", "fzaninotto/faker": "^1.4", "mockery/mockery": "^1.0", "nunomaduro/collision": "^2.0", "phpunit/phpunit": "^7.0" }, "autoload": { "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "extra": { "laravel": { "dont-discover": [ ] } }, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate" ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover" ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true }, "minimum-stability": "dev", "prefer-stable": true } </code></pre> <h2>Thank you for helping me!</h2> <h2>--EDIT--</h2> <p>After mcklayin suggest me, I look for redis data. So I run this :</p> <pre><code>vagrant@homestead:/var/lib$ redis-cli --scan presence-channel-name:members horizon:1 horizon:34 horizon:supervisors horizon:measured_jobs horizon:9 horizon:monitor:time-to-clear horizon:job:App\Jobs\ProcessModels horizon:35 horizon:queue:default horizon:job_id horizon:job:App\Events\NewModel horizon:masters horizon:last_snapshot_at horizon:33 horizon:master:homestead-xVse horizon:failed_jobs horizon:32 horizon:supervisor:homestead-xVse:supervisor-1 horizon:recent_jobs horizon:measured_queues </code></pre> <h2>--EDIT 2--</h2> <p>There is the App\Events\NewModel.php file</p> <pre><code>&lt;?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Queue\SerializesModels; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; class NewModel implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; public $data; /** * Create a new event instance. * * @return void */ public function __construct($data) { $this-&gt;data = $data; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } public function broadcastAs() { return 'NewModel'; } } </code></pre> </div>

npm突然出现错误

<div class="post-text" itemprop="text"> <p>I normally use <code>npm run watch</code> while editing sass file. <br> This time<code>npm run watch</code> was misbehaving like continuously working without stopping, but that time no errors. When I suddenly stopped it, and after few time run it again I am getting this error for no reason. I didn't do anything else after terminating the process just edited the sass file. </p> <pre><code>&gt; @ production D:\Advaith\Laravel\MyBlog &gt; cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js -- progress --hide-modules --config=node_modules/laravel- mix/setup/webpack.config.js undefined:1 SyntaxError: Unexpected end of JSON input at Object.parse (native) at Manifest.read (D:\Advaith\Laravel\MyBlog ode_modules\laravel-mix\src\Manifest.js:138:21) at new Manifest (D:\Advaith\Laravel\MyBlog ode_modules\laravel-mix\src\Manifest.js:9:43) at Mix.initialize (D:\Advaith\Laravel\MyBlog ode_modules\laravel-mix\src\Mix.js:27:25) at Object.&lt;anonymous&gt; (D:\Advaith\Laravel\MyBlog ode_modules\laravel-mix\setup\webpack.config.js:35:5) 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) npm ERR! Windows_NT 10.0.10586 npm ERR! argv "E:\\Node Js\ ode.exe" "E:\\Node Js\ ode_modules\ pm\\bin\ pm-cli.js" "run" "production" npm ERR! node v6.10.2 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules -- config=node_modules/laravel-mix/setup/webpack.config.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ production script 'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules -- config=node_modules/laravel-mix/setup/webpack.config.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules -- config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! D:\Advaith\Laravel\MyBlog pm-debug.log </code></pre> <p>As per the error I tried to update my node and npm. Before I was using node version <code>v6.6.0</code>, then I updated it to <code>v6.10.2</code>, but could not find in any change in the error other than the version.</p> <p>I tried deleting the <code>node_molecules</code> and run <code>npm install</code> again.<br> tried <code>npm cache clear</code>.</p> <p><strong>How can I fix this error??</strong></p> <p>My <code>package.json</code> file looks like this </p> <pre><code>{ "private": true, "scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch-poll": "npm run watch -- --watch-poll", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.15.3", "bootstrap-sass": "^3.3.7", "cross-env": "^3.2.3", "jquery": "^3.1.1", "laravel-mix": "0.*", "lodash": "^4.17.4", "vue": "^2.1.10" } } </code></pre> </div>

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Linux 会成为主流桌面操作系统吗?

整理 |屠敏出品 | CSDN(ID:CSDNnews)2020 年 1 月 14 日,微软正式停止了 Windows 7 系统的扩展支持,这意味着服役十年的 Windows 7,属于...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

学习总结之HTML5剑指前端(建议收藏,图文并茂)

前言学习《HTML5与CSS3权威指南》这本书很不错,学完之后我颇有感触,觉得web的世界开明了许多。这本书是需要有一定基础的web前端开发工程师。这本书主要学习HTML5和css3,看...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

新一代神器STM32CubeMonitor介绍、下载、安装和使用教程

关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang最近ST官网悄悄新上线了一款比较强大的工具:STM32CubeMonitor V1.0.0。经过我研究和使用之...

记一次腾讯面试,我挂在了最熟悉不过的队列上……

腾讯后台面试,面试官问:如何自己实现队列?

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

冒泡排序动画(基于python pygame实现)

本项目效果初始截图如下 动画见本人b站投稿:https://www.bilibili.com/video/av95491382 本项目对应github地址:https://github.com/BigShuang python版本:3.6,pygame版本:1.9.3。(python版本一致应该就没什么问题) 样例gif如下 ======================= 大爽歌作,mad

Redis核心原理与应用实践

Redis核心原理与应用实践 在很多场景下都会使用Redis,但是到了深层次的时候就了解的不是那么深刻,以至于在面试的时候经常会遇到卡壳的现象,学习知识要做到系统和深入,不要把Redis想象的过于复杂,和Mysql一样,是个读取数据的软件。 有一个理解是Redis是key value缓存服务器,更多的优点在于对value的操作更加丰富。 安装 yum install redis #yum安装 b...

现代的 “Hello, World”,可不仅仅是几行代码而已

作者 |Charles R. Martin译者 | 弯月,责编 | 夕颜头图 |付费下载自视觉中国出品 | CSDN(ID:CSDNnews)新手...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

程序员毕业去大公司好还是小公司好?

虽然大公司并不是人人都能进,但我仍建议还未毕业的同学,尽力地通过校招向大公司挤,但凡挤进去,你这一生会容易很多。 大公司哪里好?没能进大公司怎么办?答案都在这里了,记得帮我点赞哦。 目录: 技术氛围 内部晋升与跳槽 啥也没学会,公司倒闭了? 不同的人脉圈,注定会有不同的结果 没能去大厂怎么办? 一、技术氛围 纵观整个程序员技术领域,哪个在行业有所名气的大牛,不是在大厂? 而且众所...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

01、Java入门(Getting Started);02、集成开发环境(IDE);03、项目结构(Eclipse JavaProject);04、类和对象(Classes and Objects);05:词法结构(Lexical Structure);06:数据类型和变量(Data Type and Variables);07:运算符(Operators);08:控制流程语句(Control Flow Statements);

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

立即提问
相关内容推荐