Closed jingchenxu closed 7 years ago
将 package.json 第六行代码的启动脚本修改成如下试一试(没有windows电脑,未测试) set NODE_ENV=development set NODE=false webpack --progress --colors --config webpack.development.config.js && set NODE_ENV=development set NODE=true node server
@54sword 我加了cross-env 在package.json 第六行代码以后,让NODE_ENV=development能够以unix方式设置环境变量,然后在windows上也能兼容运行。但是又报了如下错,你知道是什么问题吗 xiaoduyu@0.2.0 dev D:\BaiduYunDownload\React\xiaoduyu.com-master
cross-env NODE_ENV=development NODE=false webpack --progress --colors --config webpack.development.config.js && cross-env NODE_ENV=development NODE=true node server
module.js:471 throw err; ^
Error: Cannot find module './config'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev"
npm ERR! node v6.10.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! xiaoduyu@0.2.0 dev: cross-env NODE_ENV=development __NODE__=false webpack --progress --colors --config webpack.development.config.js && cross-env NODE_ENV=development __NODE__=true node server
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xiaoduyu@0.2.0 dev script ' cross-env NODE_ENV=development NODE=false webpack --progress --colors --config webpack.development.config.js && cross-env NODE_ENV=development NODE=true node server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the xiaoduyu package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=development NODE=false webpack --progress --colors --config webpack.development.config.js && cross-env NODE_ENV=development NODE=true node server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs xiaoduyu
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls xiaoduyu
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! D:\BaiduYunDownload\React\xiaoduyu.com-master\npm-debug.log
@fengfeng94
应该是没有配置文件
cp config/index.default.js config/index.js
执行如上代码后,再试一试
@fengfeng94 刚刚10分钟前,有更新了代码,建议重新clone一份哈 服务端API有新的改动,与老代码有点不兼容
@54sword 可以了感谢,顺便问下。你学node是怎么学的,看什么书吗?
@fengfeng94
书: https://www.amazon.cn/图书/dp/B00GOM5IL4/ref=sr_1_1?ie=UTF8&qid=1493645249&sr=8-1&keywords=深入浅出node.js
视频: http://www.imooc.com/learn/75
然后就是使用起来,做实战练习做出一些东西
`PS D:\githubProject\xiaoduyu.com> npm run dev
'NODE_ENV' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev" npm ERR! node v7.4.0 npm ERR! npm v4.0.5 npm ERR! code ELIFECYCLE npm ERR! xiaoduyu@0.1.0 dev:
NODE_ENV=development __NODE__=false webpack --progress --colors --config webpack.development.config.js && NODE_ENV=development __NODE__=true node server
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the xiaoduyu@0.1.0 dev script 'NODE_ENV=development NODE=false webpack --progress --colors --config webpack.development.config.js && NODE_ENV=development NODE=true node s erver'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the xiaoduyu package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! NODE_ENV=development NODE=false webpack --progress --colors --config webpack.development.config.js && NODE_ENV=development NODE=true node server npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs xiaoduyu npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls xiaoduyu npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! D:\githubProject\xiaoduyu.com\npm-debug.log`