- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我已经在全局(首先)和某个项目(PC,windows 10)上安装了 webpack。似乎项目目录包含它需要的所有文件夹:
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try>npm install webpack --save-dev
npm WARN optional dep failed, continuing fsevents@1.0.5
webpack@1.12.9 node_modules\webpack
├── interpret@0.6.6
├── clone@1.0.2
├── tapable@0.1.10
├── async@1.5.0
├── esprima@2.7.0
├── enhanced-resolve@0.9.1 (graceful-fs@4.1.2, memory-fs@0.2.0)
├── supports-color@3.1.2 (has-flag@1.0.0)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
├── memory-fs@0.3.0 (errno@0.1.4, readable-stream@2.0.4)
├── webpack-core@0.6.8 (source-list-map@0.1.5, source-map@0.4.4)
├── loader-utils@0.2.12 (big.js@3.1.3, json5@0.4.0)
├── uglify-js@2.6.1 (async@0.2.10, uglify-to-browserify@1.0.2, source-map@0.5.3, yargs@3.10.0)
├── node-libs-browser@0.5.3 (tty-browserify@0.0.0, https-browserify@0.0.0, path-browserify@0.0.0, constants-browserify@0.0.1, punycode@1.3.2, string_decoder@0.10.31, os-browserify@0.1.2, process@0.11.2, domain-browser@1.1.4, assert@1.3.0, querystring-es3@0.2.1, timers-browserify@1.4.1, stream-browserify@1.0.0, events@1.1.0, readable-stream@1.1.13, util@0.10.3, console-browserify@1.1.0, url@0.10.3, vm-browserify@0.0.4, http-browserify@1.7.0, browserify-zlib@0.1.4, buffer@3.5.4, crypto-browserify@3.2.8)
└── watchpack@0.2.9 (graceful-fs@4.1.2, async@0.9.2, chokidar@1.4.0)
但是当我在项目目录中运行命令时:
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try>node webpack ./app.js bundle.js
它揭示了一个错误:
module.js:338
throw err;
^
Error: Cannot find module 'c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try\webpack'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:117:18)
at node.js:951:3
然后我检查 Node 的安装包:
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try>npm ls --depth=0
它说没关系(?):
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try
└── webpack@1.12.9
然而,错误仍然存在。请告诉我,它可以修复吗?如何修复?!
以防万一,这里是 node_modules/webpack/package.json 文件的内容:
{
"name": "webpack",
"version": "1.12.9",
"author": {
"name": "Tobias Koppers @sokra"
},
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
"dependencies": {
"async": "^1.3.0",
"clone": "^1.0.2",
"enhanced-resolve": "~0.9.0",
"esprima": "^2.5.0",
"interpret": "^0.6.4",
"loader-utils": "^0.2.11",
"memory-fs": "~0.3.0",
"mkdirp": "~0.5.0",
"node-libs-browser": ">= 0.4.0 <=0.6.0",
"optimist": "~0.6.0",
"supports-color": "^3.1.0",
"tapable": "~0.1.8",
"uglify-js": "~2.6.0",
"watchpack": "^0.2.1",
"webpack-core": "~0.6.0"
},
"license": "MIT",
"devDependencies": {
"benchmark": "^1.0.0",
"bundle-loader": "~0.5.0",
"codecov.io": "^0.1.2",
"coffee-loader": "~0.7.1",
"coffee-script": "^1.10.0",
"component-webpack-plugin": "~0.2.0",
"coveralls": "^2.11.2",
"css-loader": "~0.15.0",
"diff": "^2.0.2",
"eslint": "^1.1.0",
"eslint-plugin-nodeca": "^1.0.3",
"express": "~4.13.1",
"extract-text-webpack-plugin": "~0.8.0",
"file-loader": "~0.8.0",
"glob": "^5.0.14",
"i18n-webpack-plugin": "~0.2.0",
"istanbul": "^0.3.13",
"jade": "^1.11.0",
"jade-loader": "~0.7.0",
"js-beautify": "^1.5.10",
"json-loader": "~0.5.1",
"less": "^2.5.1",
"less-loader": "^2.0.0",
"mocha": "~2.2.0",
"mocha-lcov-reporter": "0.0.2",
"raw-loader": "~0.5.0",
"script-loader": "~0.6.0",
"should": "^7.0.2",
"style-loader": "~0.12.0",
"url-loader": "~0.5.0",
"val-loader": "~0.5.0",
"vm-browserify": "~0.0.0",
"webpack-dev-middleware": "^1.0.0",
"worker-loader": "~0.6.0"
},
"engines": {
"node": ">=0.6"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/webpack.git"
},
"homepage": "https://github.com/webpack/webpack",
"main": "lib/webpack.js",
"web": "lib/webpack.web.js",
"bin": {
"webpack": "./bin/webpack.js"
},
"files": [
"lib/",
"bin/",
"buildin/",
"hot/",
"web_modules/"
],
"scripts": {
"pretest": "npm run lint && npm run beautify-lint",
"test": "mocha",
"travis": "npm run cover -- --report lcovonly",
"lint": "eslint lib bin hot scripts",
"beautify-lint": "node ./scripts/beautify-check",
"beautify": "node ./scripts/beautify-rewrite",
"precover": "npm run lint && npm run beautify-lint",
"cover": "istanbul cover -x *.runtime.js node_modules/mocha/bin/_mocha",
"publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish"
},
"gitHead": "9766f2bde3c3f3e7b3b0e914c9cb81ea3a12e823",
"bugs": {
"url": "https://github.com/webpack/webpack/issues"
},
"_id": "webpack@1.12.9",
"_shasum": "2a031d66189839cc5cbf2c68f80566da2e14ff4e",
"_from": "webpack@*",
"_npmVersion": "2.10.1",
"_nodeVersion": "0.12.4",
"_npmUser": {
"name": "sokra",
"email": "tobias.koppers@googlemail.com"
},
"maintainers": [
{
"name": "sokra",
"email": "tobias.koppers@googlemail.com"
}
],
"dist": {
"shasum": "2a031d66189839cc5cbf2c68f80566da2e14ff4e",
"tarball": "http://registry.npmjs.org/webpack/-/webpack-1.12.9.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/webpack/-/webpack-1.12.9.tgz",
"readme": "ERROR: No README data found!"
}
最佳答案
当你全局安装一个模块时 npm install -g webpack
(正如 webpack 所要求的那样),它实际上在你的命令行上可用。所以你只需要运行:
webpack ./app.js bundle.js
至于你在运行时遇到的错误:
node webpack ./app.js bundle.js
那是因为当你运行 node webpack
时,你实际上(假设)传递了文件 webpack.js
(或 webpack/index.js
) 到 node
,因此出现“找不到模块”错误。
关于node.js - Node 在 Windows 10 上找不到 webpack 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34115533/
例如,我有一个父类Author: class Author { String name static hasMany = [ fiction: Book,
代码如下: dojo.query(subNav.navClass).forEach(function(node, index, arr){ if(dojo.style(node, 'd
我有一个带有 Id 和姓名的学生表和一个带有 Id 和 friend Id 的 Friends 表。我想加入这两个表并找到学生的 friend 。 例如,Ashley 的 friend 是 Saman
我通过互联网浏览,但仍未找到问题的答案。应该很容易: class Parent { String name Child child } 当我有一个 child 对象时,如何获得它的 paren
我正在尝试创建一个以 Firebase 作为我的后端的社交应用。现在我正面临如何(在哪里?)找到 friend 功能的问题。 我有每个用户的邮件地址。 我可以访问用户的电话也预订。 在传统的后端中,我
我主要想澄清以下几点: 1。有人告诉我,在 iOS 5 及以下版本中,如果您使用 Game Center 设置多人游戏,则“查找 Facebook 好友”(如与好友争夺战)的功能不是内置的,因此您需要
关于redis docker镜像ENTRYPOINT脚本 docker-entrypoint.sh : #!/bin/sh set -e # first arg is `-f` or `--some-
我是一名优秀的程序员,十分优秀!