【问题标题】:npm install seems to be not correctnpm install 似乎不正确
【发布时间】:2019-03-25 17:30:58
【问题描述】:

我尝试在 Alpine linux 容器中安装 npm 并获得堆栈,

$ npm install 

npm WARN prefer global node-gyp@3.6.2 should be installed with -g

> phantomjs-prebuilt@2.1.14 install /data/craft/templates/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /data/craft/templates/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1553504673093/phantomjs-2.1.1-linux-x86_64 -> /data/craft/templates/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /data/craft/templates/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs

> node-sass@4.5.3 install /data/craft/templates/node_modules/node-sass
> node scripts/install.js

Cached binary found at /root/.npm/node-sass/4.5.3/linux_musl-x64-48_binding.node

> uglifyjs-webpack-plugin@0.4.6 postinstall /data/craft/templates/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


> gifsicle@3.0.4 postinstall /data/craft/templates/node_modules/gifsicle
> node lib/install.js

  ⚠ spawn /data/craft/templates/node_modules/gifsicle/vendor/gifsicle ENOENT
  ⚠ gifsicle pre-build test failed
  ℹ compiling from source
  ✖ Error: autoreconf -ivf && ./configure --disable-gifview --disable-gifdiff --prefix="/data/craft/templates/node_modules/gifsicle/vendor" --bindir="/data/craft/templates/node_modules/gifsicle/vendor" && make install
Command failed: autoreconf -ivf
/bin/sh: autoreconf: not found

    at ChildProcess.exithandler (child_process.js:204:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:497:12)

> jpegtran-bin@3.2.0 postinstall /data/craft/templates/node_modules/jpegtran-bin
> node lib/install.js

  ⚠ spawn /data/craft/templates/node_modules/jpegtran-bin/vendor/jpegtran ENOENT
  ⚠ jpegtran pre-build test failed
  ℹ compiling from source
  ✖ Error: touch configure.ac aclocal.m4 configure Makefile.am Makefile.in && ./configure --disable-shared --prefix="/data/craft/templates/node_modules/jpegtran-bin/vendor" --bindir="/data/craft/templates/node_modules/jpegtran-bin/vendor" && make install
Command failed: ./configure --disable-shared --prefix="/data/craft/templates/node_modules/jpegtran-bin/vendor" --bindir="/data/craft/templates/node_modules/jpegtran-bin/vendor"
configure: error: newly created file is older than distributed files!
Check your system clock

    at ChildProcess.exithandler (child_process.js:204:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

> optipng-bin@3.1.4 postinstall /data/craft/templates/node_modules/optipng-bin
> node lib/install.js

  ⚠ spawn /data/craft/templates/node_modules/optipng-bin/vendor/optipng ENOENT
  ⚠ optipng pre-build test failed
  ℹ compiling from source
  ✖ Error: ./configure --with-system-zlib --prefix="/data/craft/templates/node_modules/optipng-bin/vendor" --bindir="/data/craft/templates/node_modules/optipng-bin/vendor" && make install
Command failed: ./configure --with-system-zlib --prefix="/data/craft/templates/node_modules/optipng-bin/vendor" --bindir="/data/craft/templates/node_modules/optipng-bin/vendor"

    at ChildProcess.exithandler (child_process.js:204:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

> pngquant-bin@3.1.1 postinstall /data/craft/templates/node_modules/pngquant-bin
> node lib/install.js

  ⚠ spawn /data/craft/templates/node_modules/pngquant-bin/vendor/pngquant ENOENT
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✖ Error: pngquant failed to build, make sure that libpng-dev is installed
    at ChildProcess.exithandler (child_process.js:204:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

> node-sass@4.5.3 postinstall /data/craft/templates/node_modules/node-sass
> node scripts/build.js

Binary found at /data/craft/templates/node_modules/node-sass/vendor/linux_musl-x64-48/binding.node
Testing binary
Binary is fine
welance-craft-base-template@0.2.0 /data/craft/templates
├── @welance/welance-bs@0.8.0 
├── abbrev@1.1.0 
├─┬ accepts@1.3.4 
│ ├── mime-db@1.30.0 

...............................
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

当我遇到很多错误(命令失败)时,我想知道npm install 是正确的还是我需要做一些额外的事情?

【问题讨论】:

  • 我觉得很好,你的项目有什么问题吗?
  • 是的,我的原帖在这里:stackoverflow.com/questions/55334131/…
  • @HagaiWild 当我将$ npm run prod 作为clean-webpack-plugin: /data/craft/public/assets is outside of the project root. Skipping... Error: spawn /data/craft/templates/node_modules/optipng-bin/vendor/optipng ENOENT at exports._errnoException (util.js:1018:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:367:16) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) 运行时出现错误

标签: node.js linux npm


【解决方案1】:

你需要做的

sudo apt-get install autoconf

在你运行 npm install 之前,这似乎是 linux 中的 autoconf 错误。

【讨论】:

  • 这不能解决问题,因此不能接受它作为答案。这是我原来的问题顺便说一句:stackoverflow.com/questions/55334131/…
  • 我必须安装autoconf和libtool,然后问题就解决了。
  • apk add autoconf libtool 在 Alpine Linux 的情况下
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-06-28
  • 1970-01-01
  • 2013-08-07
  • 2013-12-03
  • 2012-06-09
  • 2014-07-16
  • 2023-01-08
相关资源
最近更新 更多