2016-12-06 57 views
0

我使用的刮,它模塊內:https://github.com/IonicaBizau/scrape-itCheerio不是的WebPack發現模塊

我想我的捆綁與JS的WebPack ;但是,我越來越

ERROR in ./~/scrape-it/~/cheerio/index.js 
Module not found: Error: Cannot resolve 'file' or 'directory' ./package in /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio 
resolve file 

完整堆棧跟蹤:

ERROR in ./~/scrape-it/~/cheerio-req/~/cheerio/index.js 
Module not found: Error: Cannot resolve 'file' or 'directory' ./package in /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio 
resolve file 
    /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package doesn't exist 
    /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package.webpack.js doesn't exist 
    /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package.web.js doesn't exist 
    /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package.js doesn't exist 
resolve directory 
    /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package doesn't exist (directory default file) 
    /Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package/package.json doesn't exist (directory description file) 
[/Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package] 
[/Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package.webpack.js] 
[/Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package.web.js] 
[/Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio-req/node_modules/cheerio/package.js] 
@ ./~/scrape-it/~/cheerio-req/~/cheerio/index.js 11:18-38 

我爲什麼,因爲所有相應的模塊存在,這是產生一種困惑。 這是我的webpack.config.js文件,它可能是問題的根源。

var webpack = require('webpack'); 
var path = require('path'); 
var fs = require('fs'); 
var request = require('request'); 
var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); 


module.exports = { 
    entry: "./main.js", 
    output: { 
     path: __dirname, 
     filename: "bundle.js" 
    }, 
    module: { 
    loaders: [ 
     { test: /\.json$/, loader: 'json-loader' } 
     ] 
    }, 
    resolve: { 
     extensions: ['', '.webpack.js', '.web.js', '.js'] 
    }, 
    node: { 
     console: 'empty', 
     fs: 'empty', 
     net: 'empty', 
     tls: 'empty' 
    } 
} 

爲什麼會發生這種情況?這怎麼解決?

+0

你忘了'NPM install'第一嗎?你看到一個'package.json'如果你運行'LS -lAh/Users/Spicycurryman/Desktop/Main/styell/node_modules/scrape-it/node_modules/cheerio'? –

+0

@SethHolladay是的,我確實看到它,而且我沒有忘記npm install。:/還有什麼問題? –

回答