0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

webpackでnpm run buildできなかった時

Posted at

webpackでnpm run buildできなかった時

webpackでコンパイルを実行したい矢先、
ずっとエラーに悩まされていたところスッと解決できたのでメモ。

最初(エラーに苦しんでいた時)のpackage.jsonの状態。

package.json
"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack"
 },

この状態でnpm run buildすると、

> *****@1.0.0 build
> webpack

sh: webpack: command not found

このエラーに苦しめられていましたが、こちらのページを参考にしながら"build"プロパティに適切なパスを設定してやらなければいけない事がわかり、再度package.jsonを設定し、

package.json
"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "/Users/****/****/.../node_modules/.bin/webpack"
},

同じwebpackディレクトリでも今度はnpm binを実行して得られたパスを"build"プロパティに渡して実行したところ、無事うまくいきました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?