v6.7.1
const pkg = require('./package');
this line is causing issue. "package" is not defined in package.json
ERROR in ./~/is-online/~/is-reachable/~/got/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./package in /Users/alan/Desktop/Electron/app/node_modules/is-online/node_modules/is-reachable/node_modules/got
resolve file
/Users/alan/Desktop/Electron/app/node_modules/is-online/node_modules/is-reachable/node_modules/got/package doesn't exist
/Users/alan/Desktop/Electron/app/node_modules/is-online/node_modules/is-reachable/node_modules/got/package.js doesn't exist
/Users/alan/Desktop/Electron/app/node_modules/is-online/node_modules/is-reachable/node_modules/got/package.jsx doesn't exist
resolve directory
package is package.json. Extensions are optional.
I leave that here because it can help people facing similar issue.
I was having an issue with the got module (through vue-resource) like this:
ERROR in ./~/got/index.js
Module not found: Error: Can't resolve './package' in '/path/to/project/node_modules/got'
I found that the issue was caused by webpack not resolving the extension automatically, so I added this to my webpack.config.js file:
resolve: {
extensions: ['.js', '.json']
}
so now I can omit the .json extension when I require() a module.
Hope this helps someone :)
@hugohil Sir, you helped me a lot with this, i was having this './package' error, and your fix solved it!
_I leave that here because it can help people facing similar issue._
I was having an issue with the
gotmodule (throughvue-resource) like this:ERROR in ./~/got/index.js Module not found: Error: Can't resolve './package' in '/path/to/project/node_modules/got'I found that the issue was caused by webpack not resolving the extension automatically, so I added this to my
webpack.config.jsfile:resolve: { extensions: ['.js', '.json'] }so now I can omit the
.jsonextension when Irequire()a module.Hope this helps someone :)
i am facing same issue, but i didnt have webpack file in my project, so please give appropriate solution
Most helpful comment
I leave that here because it can help people facing similar issue.
I was having an issue with the
gotmodule (throughvue-resource) like this:I found that the issue was caused by webpack not resolving the extension automatically, so I added this to my
webpack.config.jsfile:so now I can omit the
.jsonextension when Irequire()a module.Hope this helps someone :)