尝试使用def main(config):
if DELETE_TS:
return "D"
else:
return "U"
打开webpack时出现以下错误:
yarn s
我尝试在Google上搜索最有希望的答案https://gist.github.com/DanHerbert/9520689,但仍然无效。有人有什么想法吗?
这是我的package.json:
yarn s
yarn run v1.7.0
$ NODE_ENV=development webpack --config webpack.development.js
/bin/sh: webpack: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
当我运行npm时,我得到:
cat package.json
{
"name": "Random",
"private": true,
"version": "1.0.0",
"engines": {
"node": "6.9.1",
"yarn": ">=0.27.5"
},
"repository": {
"type": "git",
"url": "random"
},
"scripts": {
"s": "NODE_ENV=development webpack --config webpack.development.js",
"production": "NODE_ENV=production webpack --config webpack.production.js",
"postinstall": "sh -c 'if [ \"${NODE_ENV}\" = \"production\" ]; then yarn run production; fi'",
"precommit:eslint": "git diff-index --cached HEAD --name-only --diff-filter ACMR | grep -E \"\\.jsx?$\" | xargs eslint --quiet"
},
"pre-commit": [
"precommit:eslint"
],
"dependencies": {
"assets-webpack-plugin": "^3.5.1",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "6.11.1",
"classnames": "2.2.5",
"clean-webpack-plugin": "^0.1.16",
"compression-webpack-plugin": "^1.0.0",
"happypack": "^4.0.0-beta.2",
"history": "3.0.0",
"immutable": "3.8.1",
"jquery": "3.1.1",
"json-loader": "0.5.4",
"lodash": "4.17.4",
"moment": "2.19.3",
"moment-timezone": "0.5.11",
"react": "15.3.0",
"react-addons-shallow-compare": "15.3.0",
"react-transition-group": "2.3.1",
"react-big-calendar": "^0.17.0",
"react-bootstrap": "^0.31.5",
"react-d3-cloud": "0.4.1",
"react-datepicker": "0.37.0",
"react-dates": "4.1.0",
"react-dom": "15.3.0",
"react-immutable-render-mixin": "0.9.7",
"react-linkify": "0.1.3",
"react-modal": "1.4.0",
"react-notification-system": "0.2.7",
"react-pagify": "2.0.4",
"react-pagify-preset-bootstrap": "1.0.2",
"react-redux": "4.4.5",
"react-router": "3.0.0",
"react-select": "1.0.0-rc.5",
"react-tag-input": "4.6.2",
"react-text-mask": "^5.0.2",
"redux": "3.6.0",
"redux-form": "6.2.0",
"redux-logger": "2.7.0",
"redux-thunk": "2.1.0",
"seamless-immutable": "^7.1.2",
"strip-ansi": "^4.0.0",
"text-mask-addons": "3.7.1",
"webpack": "^3.5.5"
},
"devDependencies": {
"babel-eslint": "7.1.0",
"eslint": "3.9.0",
"eslint-config-airbnb": "12.0.0",
"eslint-loader": "1.6.1",
"eslint-plugin-import": "1.16.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.4.1",
"pre-commit": "1.2.2"
}
}
当我安装node6时,我甚至不知道为什么它会得到节点10.2.1。
我在webpack.development.js中有这个:
npm s
npm ERR! search must be called with arguments
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/luciantarna/.npm/_logs/2018-05-28T13_34_20_437Z-debug.log
cat /Users/luciantarna/.npm/_logs/2018-05-28T13_34_20_437Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/10.2.1/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 's' ]
2 info using npm@5.6.0
3 info using node@v10.2.1
4 verbose stack Error: search must be called with arguments
4 verbose stack at EventEmitter.search (/usr/local/lib/node_modules/npm/lib/search.js:35:15)
4 verbose stack at Object.commandCache.(anonymous function) (/usr/local/lib/node_modules/npm/lib/npm.js:159:13)
4 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:84:30)
4 verbose stack at process._tickCallback (internal/process/next_tick.js:61:11)
5 verbose cwd /Users/luciantarna/govpredict/gov_congress
6 verbose Darwin 17.5.0
7 verbose argv "/usr/local/Cellar/node/10.2.1/bin/node" "/usr/local/bin/npm" "s"
8 verbose node v10.2.1
9 verbose npm v5.6.0
10 error search must be called with arguments
11 verbose exit [ 1, true ]
答案 0 :(得分:2)
我想你忘记了npm install
答案 1 :(得分:0)
首先,您需要运行yarn
命令来安装依赖项。