本帖最后由 谈际昌 于 2020-8-21 16:01 编辑
这是别人的配置文件,感觉跟我们不一样,是2018年写的,不知道是不是后来改版啦"scripts": { "build": "cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js",
"release": "cross-env NODE_PLATFORM=na NODE_PHASE=ol webpack --config ./node_modules/hap-tools/webpack.config.js",
"clear": "rm -rf build/* && rm -rf dist/*",
"server": "cross-env NODE_MOUNTED_ROUTER=\"debug bundle\" node ./node_modules/hap-tools/debugger/server/index.js",
"debug": "npm run server -- --debug-only --port=8081",
"notify": "node ./node_modules/hap-tools/debugger/command/notify.js",
"watch": "cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js --watch",
"watch:na": "npm run na:dv -- --watch",
"na": "npm run na:dv -- --watch",
"lint": "./node_modules/.bin/eslint src/",
"na:dv": "cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js",
"na:qa": "cross-env NODE_PLATFORM=na NODE_PHASE=qa webpack --config ./node_modules/hap-tools/webpack.config.js",
"na:ol": "cross-env NODE_PLATFORM=na NODE_PHASE=ol webpack --config ./node_modules/hap-tools/webpack.config.js",
"postinstall": "npm run postinstall:koaStatic && npm run postinstall:koaSend",
"postinstall:koaStatic": "babel -d ./node_modules/koa-static ./node_modules/koa-static",
"postinstall:koaSend": "babel -d ./node_modules/koa-send ./node_modules/koa-send"
},
我运行的时的报错,百度了一下说是平台的问题,安装cross-env就可以啦 但是我安装啦就是不行
$ npm run build
> APIDemo@1.0.0 build E:\project\公司资料\my-progect\Radcase_best\APIDemo
> cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\hap-tools\webpack.config.js'
Require stack:
- E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\convert-argv.js
- E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at module.exports (E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\convert-argv.js:80:13)
at Object. (E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\webpack.js:39:40)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'E:\\project\\公司资料\\my-progect\\Radcase_best\\APIDemo\\node_modules\\webpack\\bin\\convert-argv.js',
'E:\\project\\公司资料\\my-progect\\Radcase_best\\APIDemo\\node_modules\\webpack\\bin\\webpack.js'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! APIDemo@1.0.0 build: `cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js`
npm ERR! Exit status 1
Require stack:
- E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\convert-argv.js
- E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at module.exports (E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\convert-argv.js:80:13)
at Object. (E:\project\公司资料\my-progect\Radcase_best\APIDemo\node_modules\webpack\bin\webpack.js:39:40)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'E:\\project\\公司资料\\my-progect\\Radcase_best\\APIDemo\\node_modules\\webpack\\bin\\convert-argv.js',
'E:\\project\\公司资料\\my-progect\\Radcase_best\\APIDemo\\node_modules\\webpack\\bin\\webpack.js'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! APIDemo@1.0.0 build: `cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the APIDemo@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\node\node_global\_logs\2020-08-21T07_29_14_870Z-debug.log
|