zoukankan      html  css  js  c++  java
  • Error: Cannot find module 'webpack/schemas/WebpackOptions.json'

    1、错误原因

    C:UsersAdministratorcma>webpack you.js today.js
    internal/modules/cjs/loader.js:573
        throw err;
        ^
    
    Error: Cannot find module 'webpack/schemas/WebpackOptions.json'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
        at Function.Module._load (internal/modules/cjs/loader.js:497:25)
        at Module.require (internal/modules/cjs/loader.js:626:17)
        at require (C:UsersAdministrator
    ode_modulesv8-compile-cachev8-compile-
    cache.js:159:20)
        at Object.<anonymous> (C:UsersAdministrator
    ode_moduleswebpack-cliinc
    onfig-yargs.js:1:85)
        at Module._compile (C:UsersAdministrator
    ode_modulesv8-compile-cachev8-
    compile-cache.js:178:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
        at Module.load (internal/modules/cjs/loader.js:589:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
        at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    
    C:UsersAdministratorcma>

    2、错误原因

         在使用webpack对JavaScript文件打包时,先是提示这个

    One CLI for webpack must be installed. These are recommended choices, delivered
    as separate packages:
     - webpack-cli (https://github.com/webpack/webpack-cli)
       The original webpack full-featured CLI.
     - webpack-command (https://github.com/webpack-contrib/webpack-command)
       A lightweight, opinionated webpack CLI.
    We will use "npm" to install the CLI via "npm install -D".
    Which one do you like to install (webpack-cli/webpack-command):

         选择了webpack-cli,进行了安装

    Installing 'webpack-cli' (running 'npm install -D webpack-cli')...
    npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@n
    pmjs.com for more info.
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binesparse.cmd as
     it wasn't installed by C:UsersAdministrator
    ode_modules\_esprima@4.0.0@espri
    ma
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binesparse as it
    wasn't installed by C:UsersAdministrator
    ode_modules\_esprima@4.0.0@esprima
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binesvalidate.cmd
     as it wasn't installed by C:UsersAdministrator
    ode_modules\_esprima@4.0.0@es
    prima
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binesvalidate as
    it wasn't installed by C:UsersAdministrator
    ode_modules\_esprima@4.0.0@esprim
    a
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.bincoffee.cmd as
    it wasn't installed by C:UsersAdministrator
    ode_modulescoffee-script
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.bincake.cmd as it
     wasn't installed by C:UsersAdministrator
    ode_modulescoffee-script
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.bincoffee as it w
    asn't installed by C:UsersAdministrator
    ode_modulescoffee-script
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.bincake as it was
    n't installed by C:UsersAdministrator
    ode_modulescoffee-script
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binsemver.cmd as
    it wasn't installed by C:UsersAdministrator
    ode_modules\_semver@5.5.0@semver
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binsemver as it w
    asn't installed by C:UsersAdministrator
    ode_modules\_semver@5.5.0@semver
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.bin
    imraf.cmd as
    it wasn't installed by C:UsersAdministrator
    ode_modules\_rimraf@2.6.2@rimraf
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.bin
    imraf as it w
    asn't installed by C:UsersAdministrator
    ode_modules\_rimraf@2.6.2@rimraf
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binmkdirp.cmd as
    it wasn't installed by C:UsersAdministrator
    ode_modules\_mkdirp@0.5.1@mkdirp
    npm WARN rm not removing C:UsersAdministrator
    ode_modules.binmkdirp as it w
    asn't installed by C:UsersAdministrator
    ode_modules\_mkdirp@0.5.1@mkdirp
    npm WARN saveError ENOENT: no such file or directory, open 'C:UsersAdministrat
    orpackage.json'
    npm WARN enoent ENOENT: no such file or directory, open 'C:UsersAdministrator
    package.json'
    npm WARN webpack-cli@2.1.4 requires a peer of webpack@^4.0.0 but none is install
    ed. You must install peer dependencies yourself.
    npm WARN Administrator No description
    npm WARN Administrator No repository field.
    npm WARN Administrator No README data
    npm WARN Administrator No license field.
    
    + webpack-cli@2.1.4
    added 615 packages from 252 contributors, removed 615 packages and updated 30 pa
    ckages in 139.557s
    [!] 855 vulnerabilities found [13424 packages audited]
        Severity: 846 Low | 9 High
        Run `npm audit` for more detail
    
    { Error: Cannot find module 'webpack/schemas/WebpackOptions.json'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
        at Function.Module._load (internal/modules/cjs/loader.js:497:25)
        at Module.require (internal/modules/cjs/loader.js:626:17)
        at require (C:UsersAdministrator
    ode_modulesv8-compile-cachev8-compile-
    cache.js:159:20)
        at Object.<anonymous> (C:UsersAdministrator
    ode_moduleswebpack-cliinc
    onfig-yargs.js:1:85)
        at Module._compile (C:UsersAdministrator
    ode_modulesv8-compile-cachev8-
    compile-cache.js:178:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
        at Module.load (internal/modules/cjs/loader.js:589:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
        at Function.Module._load (internal/modules/cjs/loader.js:520:3) code: 'MODUL
    E_NOT_FOUND' }
          安装过程中,提示了很多不能移除,找不到相关的json文件

    3、解决办法

         cnpm install --save-dev webpack

    C:UsersAdministrator>cnpm install --save-dev webpack
     [0/1] Installing object.pick@^1.3.0[fast-deep-equal@2.0.1] download Error: GET
     http://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-2.0.1.t
    gz response 504 status, fail count: 1
    / [0/1] Installing uglifyjs-webpack-plugin@^1.2.4[npminstall:get] retry GET http
    s://registry.npm.taobao.org/uglifyjs-webpack-plugin after 100ms, retry left 4, e
    rror: SyntaxError: Unexpected end of JSON input
    - [0/1] Installing is-descriptor@^1.0.0[npminstall:get] retry GET https://regist
    ry.npm.taobao.org/acorn after 100ms, retry left 4, error: ResponseError: socket
    hang up (req "error"), GET https://registry.npm.taobao.org/acorn -1 (connected:
    true, keepalive socket: false, agent status: {"createSocketCount":21,"createSock
    etErrorCount":0,"closeSocketCount":3,"errorSocketCount":0,"timeoutSocketCount":1
    ,"requestCount":138,"freeSockets":{"registry.npm.taobao.org:443::::::::true:::::
    :::":4},"sockets":{"registry.npm.taobao.org:443::::::::true::::::::":4,"cdn.npm.
    taobao.org:443::::::::true::::::::":10},"requests":{"cdn.npm.taobao.org:443:::::
    :::true::::::::":12}})
    headers: {}
     [0/1] Installing kind-of@^3.0.2platform unsupported webpack@4.10.2 › watchpac
    k@1.6.0 › chokidar@2.0.3 › fsevents@^1.1.2 Package require os(darwin) not comp
    atible with your platform(win32)
    [fsevents@^1.1.2] optional install error: Package require os(darwin) not compati
    ble with your platform(win32)
    / [0/1] Installing minimalistic-crypto-utils@^1.0.1[npminstall:get] retry GET ht
    tps://registry.npm.taobao.org/move-concurrently after 100ms, retry left 4, error
    : ResponseError: socket hang up (req "error"), GET https://registry.npm.taobao.o
    rg/move-concurrently -1 (connected: true, keepalive socket: true, agent status:
    {"createSocketCount":23,"createSocketErrorCount":0,"closeSocketCount":4,"errorSo
    cketCount":0,"timeoutSocketCount":2,"requestCount":415,"freeSockets":{"registry.
    npm.taobao.org:443::::::::true::::::::":8},"sockets":{"cdn.npm.taobao.org:443:::
    :::::true::::::::":10,"registry.npm.taobao.org:443::::::::true::::::::":1},"requ
    ests":{"cdn.npm.taobao.org:443::::::::true::::::::":16}})
    headers: {}
     [0/1] Installing once@^1.4.0[npminstall:get] retry GET https://registry.npm.ta
    obao.org/component-emitter after 100ms, retry left 4, error: ResponseError: sock
    et hang up (req "error"), GET https://registry.npm.taobao.org/component-emitter
    -1 (connected: true, keepalive socket: true, agent status: {"createSocketCount":
    26,"createSocketErrorCount":0,"closeSocketCount":7,"errorSocketCount":0,"timeout
    SocketCount":3,"requestCount":436,"freeSockets":{"registry.npm.taobao.org:443:::
    :::::true::::::::":9},"sockets":{"cdn.npm.taobao.org:443::::::::true::::::::":10
    },"requests":{"cdn.npm.taobao.org:443::::::::true::::::::":21}})
    headers: {}
     [0/1] Installing is-buffer@^1.1.5[npminstall:get] retry GET https://registry.n
    pm.taobao.org/run-queue after 100ms, retry left 4, error: ResponseError: socket
    hang up (req "error"), GET https://registry.npm.taobao.org/run-queue -1 (connect
    ed: true, keepalive socket: true, agent status: {"createSocketCount":26,"createS
    ocketErrorCount":0,"closeSocketCount":14,"errorSocketCount":0,"timeoutSocketCoun
    t":7,"requestCount":499,"freeSockets":{"cdn.npm.taobao.org:443::::::::true::::::
    ::":7,"registry.npm.taobao.org:443::::::::true::::::::":1},"sockets":{"cdn.npm.t
    aobao.org:443::::::::true::::::::":3,"registry.npm.taobao.org:443::::::::true:::
    :::::":1},"requests":{}})
    headers: {}
    / [0/1] Installing aproba@^1.1.1[npminstall:get] retry GET https://registry.npm.
    taobao.org/p-limit after 100ms, retry left 4, error: ResponseError: socket hang
    up (req "error"), GET https://registry.npm.taobao.org/p-limit -1 (connected: tru
    e, keepalive socket: true, agent status: {"createSocketCount":27,"createSocketEr
    rorCount":0,"closeSocketCount":25,"errorSocketCount":0,"timeoutSocketCount":17,"
    requestCount":506,"freeSockets":{"cdn.npm.taobao.org:443::::::::true::::::::":1,
    "registry.npm.taobao.org:443::::::::true::::::::":1},"sockets":{},"requests":{}}
    )
    headers: {}
    √ Installed 1 packages
    √ Linked 256 latest versions
    √ Run 0 scripts
    Recently updated (since 2018-05-25): 21 packages (detail see file C:UsersAdmin
    istrator
    ode_modules.recently_updates.txt)
      Today:
        → webpack@4.10.2 › acorn@^5.0.0(5.6.1) (15:49:17)
    √ All packages installed (263 packages installed from npm registry, used 3m, sp
    eed 26.89kB/s, json 257(1.73MB), tarball 3.23MB)

  • 相关阅读:
    11.2hadoop监控:日志配置、堆栈跟踪、度量和JMX
    11.1.3hadoop工具dfsadmin、fsck、数据库扫描器、均衡器
    11.1.2hadoop 安全模式
    11.1.1namenode和datanode的数据结构和格式以及镜像fsimage和编辑日志edit
    10.5 hadoop集群基准评测程序测试
    10.4 hadoop安全性kerberos安全验证和委托令牌
    零基础学习python_生成器(49课)
    安全测试5_服务端的安全漏洞(SQL注入、命令注入、文件操作类)
    安全测试4_客户端的安全漏洞(XSS、CSRF、点击劫持、URL跳转)
    零基础学习python_魔法方法(41-48课)(迭代器)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13313785.html
Copyright © 2011-2022 走看看