NPM服务器维修,npm run dev无法启动服务器

我正在尝试执行“ npm run dev”,但它没有启动服务器。我以为应该打开http://127.0.0.1:8000。我如何做到这一点? “ npm start”工作并转到我的本地主机。我在寻找答案,但找不到任何东西。如果有人可以帮助我或为我提供答案的链接,我将不胜感激。我是新来的。谢谢。如果有帮助:

npm -v

6.4.1

节点-v

v10.13.0

webpack -v

4.20.2

package.json:

{

"name": "cocos-skeleton",

"description": "",

"version": "1.0.0",

"main": "main.js",

"author": "",

"license": "UNLICENSED",

"private": true,

"repository": {

"type": "git",

"url": ""

},

"scripts": {

"lint": "cross-env eslint src",

"test": "cross-env jest --passWithNoTests",

"test:watch": "cross-env jest --passWithNoTests --watch --notify",

"test:coverage": "cross-env jest --coverage",

"config": "cross-env webpack --config tools/webpack/webpack.config.js",

"bundle": "cross-env npm run config -- --mode production",

"bundle:watch": "cross-env npm run config -- --mode development --watch --progress --display-error-details",

"compile": "cross-env cocos compile",

"start": "cross-env cocos run",

"dev": "cross-env npm run bundle:watch & npm run start",

"refresh": "cross-env npm run compile && npm run start",

"release": "cross-env cocos run -m release"

},

"husky": {

"hooks": {

"pre-commit": "lint-staged"

}

},

"lint-staged": {

"linters": {

"*.js": [

"eslint --fix",

"jest --bail --findRelatedTests",

"git add"

]

},

"ignore": [

"**/frameworks/**/*.js"

]

},

"dependencies": {

"@babel/polyfill": "^7.0.0",

"howler": "^2.0.15",

"lodash": "^4.17.11",

"prando": "^3.0.3"

},

"devDependencies": {

"@babel/core": "^7.0.0",

"@babel/plugin-proposal-class-properties": "^7.0.0",

"@babel/preset-env": "^7.0.0",

"babel-core": "^7.0.0-bridge.0",

"babel-eslint": "^8.2.3",

"babel-loader": "^8.0.0",

"babel-plugin-lodash": "^3.3.4",

"cross-env": "^5.2.0",

"eslint": "^5.6.1",

"eslint-config-airbnb-base": "^13.1.0",

"eslint-plugin-import": "^2.14.0",

"husky": "^1.1.0",

"jest": "^23.6.0",

"lint-staged": "^7.3.0",

"lodash-webpack-plugin": "^0.11.5",

"prettier-eslint": "^8.8.2",

"webpack": "^4.20.2",

"webpack-cli": "^3.1.2"

},

"eslintConfig": {

"parser": "babel-eslint",

"extends": "airbnb-base",

"globals": {

"cc": true,

"ccui": true

},

"env": {

"browser": true,

"jest": true

},

"rules": {

"func-names": [

"error",

"as-needed"

],

"no-console": [

"error",

{

"allow": [

"warn",

"error",

"assert"

]

}

],

"complexity": [

"error",

5

],

"max-params": [

"error",

5

],

"max-depth": [

"error",

4

],

"max-statements": [

"error",

20

],

"max-lines-per-function": [

"error",

50

],

"max-classes-per-file": [

"error",

1

],

"max-nested-callbacks": [

"error",

3

],

"max-statements-per-line": [

"error",

{

"max": 1

}

]

}

},

"jest": {

"bail": true,

"coverageThreshold": {

"global": {

"branches": 0,

"functions": 0,

"lines": 0,

"statements": 0

}

},

"collectCoverageFrom": [

"src/**/*.js"

],

"moduleNameMapper": {

"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|cur)$": "/src/lib/mocks/FileMock.js"

}

},

"babel": {

"presets": [

[

"@babel/preset-env",

{

"useBuiltIns": "usage",

"targets": {

"ie": "11"

}

}

]

],

"plugins": [

"@babel/plugin-proposal-class-properties"

]

},

"prettier": {

"singleQuote": true,

"trailingComma": "all",

"printWidth": 100

}

}

webpack.config.js:

const { join } = require('path');

const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');

const { dependencies } = require('../../package.json');

const sourcePath = join(`${__dirname}/../../src`);

module.exports = {

entry: { main: './src/index.js', vendor: Object.keys(dependencies) },

optimization: { splitChunks: { name: 'vendor', minChunks: 2 } },

module: {

rules: [

{

test: /\.js$/,

include: sourcePath,

loader: 'babel-loader',

options: {

presets: [

[

'@babel/preset-env',

{

useBuiltIns: 'usage',

targets: {

ie: 11,

},

},

],

],

plugins: ['@babel/plugin-proposal-class-properties', 'lodash'],

},

},

],

},

plugins: [new LodashModuleReplacementPlugin()],

};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值