wechat-miniprogram/miniprogram-cli

"npm run dev" error

CodingGorit opened this issue · 2 comments

problem

[18:22:50] Error: File not found with singular glob: C:\Users\Gorit\Desktop\test\miniprogram_dev\package.json (if this was purposeful, use allowEmpty option)
at Glob. (C:\Users\Gorit\Desktop\test\node_modules\glob-stream\readable.js:84:17)
at Object.onceWrapper (events.js:422:26)
at Glob.emit (events.js:315:20)
at Glob.EventEmitter.emit (domain.js:467:12)
at Glob._finish (C:\Users\Gorit\Desktop\test\node_modules\glob\glob.js:194:8)
at done (C:\Users\Gorit\Desktop\test\node_modules\glob\glob.js:179:14)
at Glob._processSimple2 (C:\Users\Gorit\Desktop\test\node_modules\glob\glob.js:688:12)
at C:\Users\Gorit\Desktop\test\node_modules\glob\glob.js:676:10
at Glob.stat2 (C:\Users\Gorit\Desktop\test\node_modules\glob\glob.js:772:12)
at lstatcb
(C:\Users\Gorit\Desktop\test\node_modules\glob\glob.js:764:12)

solve

use devDependencies like this

  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.28.0",
    "@typescript-eslint/parser": "^2.28.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "babel-plugin-module-resolver": "^3.2.0",
    "babel-preset-env": "^1.7.0",
    "colors": "^1.3.1",
    "eslint": "^5.14.1",
    "eslint-config-airbnb-base": "13.1.0",
    "eslint-loader": "^2.1.2",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-node": "^7.0.1",
    "eslint-plugin-promise": "^3.8.0",
    "glob": "7.2.0",
    "gulp": "^4.0.0",
    "gulp-clean": "^0.4.0",
    "gulp-if": "^2.0.2",
    "gulp-install": "^1.1.0",
    "gulp-less": "^4.0.1",
    "gulp-rename": "^1.4.0",
    "gulp-sourcemaps": "^2.6.5",
    "jest": "^23.5.0",
    "miniprogram-api-typings": "^2.10.3-1",
    "miniprogram-simulate": "^1.2.5",
    "thread-loader": "^2.1.3",
    "through2": "^2.0.3",
    "ts-loader": "^7.0.0",
    "typescript": "^3.8.3",
    "vinyl": "^2.2.0",
    "webpack": "^4.29.5",
    "webpack-node-externals": "^1.7.2"
  },

Problem recurrence

  1. use miniprogram init --type custom-component command generate a template project, after installing all the devDependencies.
  2. and run "npm run dev" will lead the problem
  1. check whether tools/demo/package.json exists ?
  2. if it exists, remove dir miniprogram_dev and rerun npm run dev

According to tools/config.js, tools/demo will be copied to miniprogram_dev.