题目描述
唉,真是多事,用NPM装JQ,搞得现在项目打不开,求大佬帮忙。
相关代码
下面是按他的方法弄的
1、在项目中安装jquery。
npm install jquery --save-dev
2、在项目根目录下的build/webpack.base.conf.js
文件中:
① 先写以下代码
var webpack = require("webpack")
②在module.exports的最后写
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jQuery: "jquery",
$: "jquery"
})
]
你期待的结果是什么?实际看到的错误信息又是什么?
$ cnpm run dev
npm ERR! file D:\积分商城\integral_mall\package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token } in JSON at position 537 while parsing near '...outer": "^3.0.1",
npm ERR! JSON.parse },
npm ERR! JSON.parse "devDependencie...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator.WIN7-1610061624\AppData\Roaming\npm-cache\_logs\2018-11-02T02_03_03_081Z-debug.log
已解决相关问题