首先,我尝试了所有webpack error on build run. 'Error: Cannot find module '@webassemblyjs/ast''的答案,但是由于我使用了新的Webpack功能,因此无法降低Webpack版本。
我有一个现有的wep应用程序,正在尝试在新服务器上安装。在旧服务器和本地服务器上都运行良好。但是,我得到了一个运行CentOS的新VPS,并刚刚安装了node和npm。 (使用https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-server),它们似乎工作正常。所有模块似乎都正确安装。但是,当我尝试安装webpack时,出现了找不到@webassemblyjs/ast
的错误。我实际上可以在我的node_modules
目录中找到该文件。
(ELFSH) [root@server ELFSH]# rm -rf node_modules
(ELFSH) [root@server ELFSH]# rm package-lock.json
rm: remove regular file 'package-lock.json'? y
(ELFSH) [root@server ELFSH]# npm install
npm WARN deprecated babel-preset-es2015@6.24.1: Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN elfsh@1.0.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 630 packages from 317 contributors and audited 7730 packages in 15.47s
found 0 vulnerabilities
(ELFSH) [root@server ELFSH]# npm run debug
> elfsh@1.0.0 debug /root/ELFSH
> webpack --debug
/root/ELFSH/node_modules/webpack-cli/bin/cli.js:244
throw err;
^
Error: Cannot find module '@webassemblyjs/ast'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/root/ELFSH/node_modules/webpack/lib/wasm/WebAssemblyParser.js:7:11)
at Module._compile (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/root/ELFSH/node_modules/webpack/lib/wasm/WebAssemblyModulesPlugin.js:8:27)
at Module._compile (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/root/ELFSH/node_modules/webpack/lib/WebpackOptionsApply.js:11:34)
at Module._compile (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/root/ELFSH/node_modules/webpack/lib/webpack.js:10:29)
at Module._compile (/root/ELFSH/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elfsh@1.0.0 debug: `webpack --debug`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elfsh@1.0.0 debug script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-13T14_35_30_410Z-debug.log
(ELFSH) [root@server ELFSH]# node --version
v10.14.0
(ELFSH) [root@server ELFSH]# npm --version
6.4.1
我确认我在工作系统上具有完全相同的节点和npm版本。我尝试显式安装@webassemblyjs/ast
,但没有任何区别。节点配置必须有一些软性问题,也许是在首次安装后需要执行一些额外的步骤。任何帮助将不胜感激。