Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

update-ns-webpack, error updating webpack config #1144

Open
1 task done
funder7 opened this issue Aug 13, 2020 · 0 comments
Open
1 task done

update-ns-webpack, error updating webpack config #1144

funder7 opened this issue Aug 13, 2020 · 0 comments

Comments

@funder7
Copy link

funder7 commented Aug 13, 2020

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

Describe the bug

Error showing after launching ./node_modules/.bin/update-ns-webpack --configs:

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module '../projectHelpers'
Require stack:
- **project_dir**/node_modules/@nativescript/webpack/verify/update.js
- **project_dir**/node_modules/@nativescript/webpack/bin/update-ns-webpack
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (**project_dir**/node_modules/@nativescript/webpack/verify/update.js:8:5)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '**project_dir**/node_modules/@nativescript/webpack/verify/update.js',
    '**project_dir**/node_modules/@nativescript/webpack/bin/update-ns-webpack'
  ]
}

(paths are hidden by myself, they're showing correctly in the original output)

To Reproduce
I was updating an old project (a plugin), after running npm install i received a notice:

Note: webpack.config.js is different than the suggested @nativescript/webpack config at ..project_dir/node_modules/@nativescript/webpack/templates/webpack.angular.js.
If you have build trouble you can update to latest config using "./node_modules/.bin/update-ns-webpack --configs" command.

Running the suggested command is throwing the error.

Expected behavior

  • the update command should be updated to the latest version
  • it should update your webpack configuration without any errors

Additional context
I was going to open a PR to fix this, unfortunately the github repo doesn't seem to be aligned with the latest npm release (2.1.3), the most updated branch (feat/webpack-updates) is at 2.0.0-alpha.3 ... Please, if possible keep repo's tags aligned in order to let people contribute ;)

** Fix **

const {
    getPackageJson,
    getProjectDir,
    writePackageJson,
} = require("../projectHelpers");

Replace with:

const {
    getPackageJson,
    getProjectDir,
    writePackageJson,
} = require("../helpers/projectHelpers");
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant