Пряжа 1.7 не может начать webpack - PullRequest
0 голосов
/ 28 мая 2018

При попытке открыть веб-пакет с помощью yarn s я получаю следующую ошибку:

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.

Я пытался найти в Google ответ, который обещал наиболее многообещающий https://gist.github.com/DanHerbert/9520689, но все равно не работает,У кого-нибудь есть идеи?

Это мой package.json:

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"
  }
}

Когда я запускаю npm s, я получаю:

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 ]

Я даже не знаюпочему он получает узел 10.2.1, когда я установил узел 6.

У меня есть это в webpack.development.js:

cat webpack.development.js
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const StatusPlugin = require('./front/utils/webpack-status-plugin');
const HappyPack = require('happypack');

const paths = {
  src: path.join(__dirname, 'front'),
  dest: path.join(__dirname, 'public', 'front'),
};

module.exports = {
  context: paths.src,
  devtool: 'eval',
  entry: {
    application: ['babel-polyfill', './application.js'],
    admin: ['babel-polyfill', './admin.js'],
    portal: ['babel-polyfill', './portal.js'],
  },
  externals: {
    jquery: 'jQuery',
    underscore: '_',
  },
  output: {
    path: paths.dest,
    filename: '[name].bundle.js',
    sourceMapFilename: '[name].js.map',
  },
  module: {
    loaders: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loader: 'happypack/loader',
      },
      {
        parser: {
          amd: false,
        },
      },
    ],
  },
  plugins: [
    new CleanWebpackPlugin(paths.dest),
    new HappyPack({
      loaders: ['babel-loader'],
      verbose: false,
    }),
    StatusPlugin,
  ],
  resolve: {
    modules: [paths.src, 'node_modules'],
  },
  watch: true,
  watchOptions: {
    ignored: /node_modules/,
  },
};

1 Ответ

0 голосов
/ 28 мая 2018

Я думаю, что вы забыли запустить npm install

...