我在写“ npm start”时遇到了这个错误,但是我不知道为什么任何知道此问题的人都会看到错误消息?
如果需要帮助,我可以使用babel.js react.js webpack.js来获取最新的更新信息
module: {
^
SyntaxError: Unexpected token :
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at WEBPACK_OPTIONS (/var/www/html/nivus/node_modules/webpack-cli/bin/convert-argv.js:133:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nivus@0.1.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nivus@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
这是我的package.json,我什么都没错过,
{
"name": "nivus",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "1.1.5"
},
"scripts": {
"start": "webpack-dev-server",
"dev": "webpack --mode development --progress",
"build": "webpack --mode production --progress"
},
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/helper-explode-class": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"html-webpack-plugin": "^4.0.0-beta.1",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
}
}
这是我的webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.export = {
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
]
},
plugins: [
new HtmlWebpackPlugin()
]
}
答案 0 :(得分:0)
我认为=(MAX(if(O80:O85<Y80,O80:O85)),O80:O85,0))* (1+INDEX(P80:P85,MATCH(MAX(if(O80:O85<Y80,O80:O85)),O80:O85,0)))
之后的行中的},
不应该存在。
答案 1 :(得分:0)
SyntaxError:意外令牌:...
如果您在npm start
期间收到此消息,则可能是由于.json
文件之一中的语法错误而导致npm无法启动。
在这种情况下,问题出在webpack中。
module.export = {
module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" } ]
},
plugins: [ new HtmlWebpackPlugin() ]
}