shakacode/bootstrap-loader

Something to do with Resolve@1.7.0 which released yesterday. Cannot find module '.....\node_modules\bootstrap-sass\package.json\package.json'

ttma1046 opened this issue ยท 17 comments

Since yesterday's release of Resolve@1.7.0
resolveModule.js returns the ....\node_modules\bootstrap-sass\package.json instead of ....\node_modules\bootstrap-sass\

@ttma1046 I have the same problem, Module build failed: Error: Cannot find module '/Users/gaurav_mamidwar/work/web/node_modules/bootstrap/package.json/package.json'.
Does anybody know how to resolve this?

I am having the same issue.
ERROR in .//bootstrap-loader/lib/bootstrap.loader.js!.//bootstrap-loader/no-op.js
Module build failed: Error: Cannot find module '/node_modules/bootstrap/package.json/package.json'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)

Facing the same issue as @phyoemdy, since bootstrap-loader includes "resolve" with a minor semver definition that pulls in resolve@1.7.0

I added this to my package.json for now (we use Yarn):
... "resolutions": { "**/bootstrap-loader/resolve": "1.6.0" }, ...

Have the same issue.

Used @michaelwalloschke 's solution and it works great.

I basically hardcode the version number of 'resolve' npm install resolve@1.4.0 --save-dev in my project, and it works.

@ttma1046 That works, but it makes resolve a dependency of your project.

I pinned to version 1.6.0 in package-lock.json by following the instruction here

An alternative solution is to add bootstrapPath=path/to/bootstrap-sass in the query string for your bootstrap.loader entry in your Webpack config. When this parameter is provided, bootstrap-loader does not need to use resolve to infer the path, thus circumventing the breaking change in resolve.

Same problem here. npm install resolve@1.6.0 in my project worked for me.

A PR would be appreciated! I'll review ASAP if one can get submitted.

@justin808 There is a PR ready :)

I found the problem:

bootstrap-loader/src/utils/checkBootstrapVersion.js

Line 14

From
const npmVersion = require(path.join(bootstrapPath, 'package.json')).version;

To
const npmVersion = require(path.join(bootstrapPath)).version;

Explanation the var bootstrapPath include the "package.json"

checkBootstrapVersion.js.zip

@blasruiz

This is not the problem and this is also not the fix.

The cause of the issue is that the dependency 'resolve'@1.7.0 returns the bootstrapPath including 'package.json', it doesn't in its previous version.

@blasruiz There is a high change of this approach to stop working and i would not recommend this when there is a very simple workaround where you do not need to edit code in your node_modules directory. Just pin resolve to version 1.6.0 in your package.json until there is a proper fix.

I think this has been fixed in the new patched version of "resolve" (1.7.1). https://github.com/browserify/resolve/releases/tag/v1.7.1