English 中文(简体)
Error: spawn /data/craft/templates/node_modules/optipng-bin/vendor/optipng ENOENT
原标题:Error: spawn /data/craft/templates/node_modules/optipng-bin/vendor/optipng ENOENT

我试图将<条码>的npm 操作成<>/code> 放在Alepinelav集装箱内,并产生错误。

I followed the procedure,

  1. In the /data directory of the linux, I run the command $ apk add --update nodejs nodejs-npm which install the node and the npm in the container
  2. I enter inside the /data/craft/templets directory and run the command $ npm install
  3. In the same location, I run the command $ npm run prod

我发现错误,

bash-4.3# npm run prod 

> [email protected] prod /data/craft/templates
> NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js

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)

npm ERR! Linux 4.9.87-linuxkit-aufs
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "prod"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] prod: `NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] prod script  NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js .
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 welance-craft-base-template package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs welance-craft-base-template
npm ERR! Or if that isn t available, you can get their info via:
npm ERR!     npm owner ls welance-craft-base-template
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /data/craft/templates/npm-debug.log

我的勇气

ietms are provided, 

bash-4.3# pwd
/data/craft/templates
bash-4.3# ls 
404.html                  _entries                  ea6dc030-add9-4616-97bb-8370c05e82cb  npm-shrinkwrap.json
4d5217b7-6edb-4d71-9149-a50085dbaa0e  _includes                 eb5f1516-3384-4171-9cec-4c71c9bb36e7  package.json
9a45fea3-db13-47a8-9fc0-6c7063f8d768  b7ee1be3-9d27-4602-a93e-0da6a2a5eaa9  efdf951a-587f-46ed-b2da-69ec16f10824  postcss.config.js
README.md                 ce149251-fed6-4083-bf27-d60fd41d7905  node_modules              web.config
__src                     e4701b6f-c517-4625-babd-578e6689805b  npm-debug.log             webpack

提供<代码><<>代码>产出。

bash-4.3# cat /data/craft/templates/npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [  /usr/bin/node ,  /usr/bin/npm ,  run ,  prod  ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [  preprod ,  prod ,  postprod  ]
5 info lifecycle [email protected]~preprod: [email protected]
6 silly lifecycle [email protected]~preprod: no script for preprod, continuing
7 info lifecycle [email protected]~prod: [email protected]
8 verbose lifecycle [email protected]~prod: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~prod: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/data/craft/templates/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle [email protected]~prod: CWD: /data/craft/templates
11 silly lifecycle [email protected]~prod: Args: [  -c ,
11 silly lifecycle    NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js  ]
12 silly lifecycle [email protected]~prod: Returned: code: 1  signal: null
13 info lifecycle [email protected]~prod: Failed to exec prod script
14 verbose stack Error: [email protected] prod: `NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /data/craft/templates
17 error Linux 4.9.87-linuxkit-aufs
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "prod"
19 error node v6.10.3
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] prod: `NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js`
22 error Exit status 1
23 error Failed at the [email protected] prod script  NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js .
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the welance-craft-base-template package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     NODE_ENV= prod  env UV_THREADPOOL_SIZE=100 webpack -p --config webpack/webpack.prod.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs welance-craft-base-template
23 error Or if that isn t available, you can get their info via:
23 error     npm owner ls welance-craft-base-template
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

The file web Pack/web Pack.prod.js is provided below,

bash-4.3# cat webpack/webpack.prod.js
const merge = require( webpack-merge );
const common = require( ./webpack.common.js );
const path = require( path );

const webpack = require("webpack");
const UglifyJSPlugin = require( uglifyjs-webpack-plugin );
const ExtractTextPlugin = require( extract-text-webpack-plugin );
const HtmlWebpackPlugin = require( html-webpack-plugin );

const ImageminWebpackPlugin = require( imagemin-webpack-plugin ).default;
const FaviconsWebpackPlugin = require( favicons-webpack-plugin );

const imagesPath = path.resolve(__dirname,  ../__src/images );
const rootPath = path.resolve(__dirname);

module.exports = merge(common, {
  devtool:  source-map ,
  plugins: [
        //about SASS compilation
        new ExtractTextPlugin({
            filename: "styles/main.min.css"
        }),
        new ImageminWebpackPlugin({
            test: /.(jpe?g|png|gif|svg)$/i,
            //disable: process.env.NODE_ENV !==  prod ,
            pngquant: {
                quality:  95-100 
            },
            optipng: {
                optimizationLevel: 5 //0-7 (7 slower)
            },
            jpegtran: {
                progressive: true
            },
            gifsicle: {
                optimizationLevel: 3 //1-3 (3 slower)
            }
        }),
        new FaviconsWebpackPlugin({
            // Your source logo
            logo: imagesPath +  /favicon.png ,
            // The prefix for all image files (might be a folder or a name)
            prefix:  images/icons-[hash]/ ,
            // Emit all stats of the generated icons
            emitStats: false,
            // The name of the json containing all favicon information
            statsFilename:  iconstats-[hash].json ,
            // Generate a cache file with control hashes and
            // don t rebuild the favicons until those hashes change
            persistentCache: true,
            // Inject the html into the html-webpack-plugin
            inject: true,
            // favicon background color (see https://github.com/haydenbleasel/favicons#usage)
            //background:  #fff ,
            // favicon app title (see https://github.com/haydenbleasel/favicons#usage)
            title:  GGFutures.net ,

            // which icons should be generated (see https://github.com/haydenbleasel/favicons#usage)
            icons: {
                android: true,
                appleIcon: true,
                appleStartup: true,
                coast: false,
                favicons: true,
                firefox: true,
                opengraph: false,
                twitter: false,
                yandex: false,
                windows: false
            }
        }),
    new webpack.optimize.CommonsChunkPlugin({ name:  vendor , filename:  scripts/vendor.min.js?h=[hash]  })
  ]
})

Thank you.

PS I try to delete the node modules and re-install the npm again which was not fruitful,

$ rm -rf node_modules/
$ npm install

我也尝试利用这些指挥系统,

$ npm install rimraf -g
$ rimraf node_modules
最佳回答

因此,我也遇到了同样的问题,特别是把这些指挥推向一个生态2级。

∗∗∗∗∗∗∗∗∗

问题回答

1.download gzipped archive of optipng source from SourceForge and run build commands i.e. ./configure --with-system-zlib ... 2.copy the folder(ersrc/optpng/build/node_modules/optpng-bin) to optipng-bin in the node_modules folder of your project 3.run your project





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签