grunt generate-sources is failing with 'cannot find modules' and syntax error - gruntjs

Hi All,
We are facing an issue with mvn install where grunt generate-sources is failing with 'cannot find modules' error, for example it says node modules findup-sync, ini, has...etc, if we install these node modules separately there are some other modules which are missing and throwing below errors
**module not found error**:
Executing command line: /appserver/jenkins/workspace/project/./node_modules/.bin/grunt generate-sources --verbose
module.js:478
throw err;
Error: Cannot find module 'findup-sync'
at Function.Module./_resolveFilename (module.js:476:15)
at Function.Module./_load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object./ (/appserver/jenkins/workspace/project/node_modules/grunt-cli/bin/grunt:8:14)
at Module./_compile (module.js:577:32)
at Object.Module./_extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module./_load (module.js:445:3)
**Syntax error**:
Executing command line: grunt.cmd generate-sources --verbose
C:/Users/AppData/Roaming/nvm/v6.14.4/node_modules/npm/node_modules/grunt-cli/node_modules/micromatch/index.js:44
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (C:/Users/AppData/Roaming/nvm/v6.14.4/node_modules/npm/node_modules/grunt-cli/node_modules/findup-sync/index.js:12:10)
The same build was working last month without any changes to code and configuration, but now it's failing with the above mentioned errors, below are the version details
npm#3.10.10
node#v6.14.4
Could you please let me know what might cause this issue and how to resolve, thanks a lot in advance!
I have tried below steps:
Tried with different node versions 6.14.4, 6.17.1, 10.13.0
Tried with different grunt-cli versions 0.1.13, 1.0.2, 1.4.2, when we are running with different grunt cli versions we are seeing different node modules are missing
Tried removing node modules and install again
Tried installing missing node modules, if we install one, then it's giving some other module is missing
npm install findup-sync -g
npm link findup-sync
npm install grunt-cli -g

Related

Running pnpm lint-fix on a nextjs repository

I have a pull request in with the nextjs project here:
https://github.com/vercel/next.js/pull/45238
To get it accepted, I need to run pnpm lint-fix on the code.
I am utterly unfamiliar with pnpm and Python, but I got the latter installed correctly and then the former. I ran pnpm install and I then ran pnpm install lint-fix
It all installed. Or at least it appeared to do so.
Then, I try to run pnpm lint-fix and the result is:
PS C:\code\next.js\examples\auth-passage-passwordless> pnpm lint-fix
Error: Module build failed: TypeError: /home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/lib/bin.js: Duplicate declaration "b" (This is an error on an internal node. Probably an internal error.)
at File.buildCodeFrameError (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/lib/transformation/file/file.js:209:12)
at Scope.checkBlockScopedCollisions (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/scope/index.js:303:27)
at Scope.registerBinding (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/scope/index.js:485:16)
at Scope.registerDeclaration (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/scope/index.js:404:14)
at Object.BlockScoped (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/scope/index.js:146:28)
at Object.newFn (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/visitors.js:266:17)
at NodePath._call (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/path/context.js:64:19)
at NodePath.call (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/path/context.js:34:14)
at NodePath.visit (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/path/context.js:99:12)
at TraversalContext.visitQueue (/home/gitlab-runner/builds/8a39c300/0/pr/lint-fix/node_modules/#babel/core/node_modules/#babel/traverse/lib/context.js:139:18)
at Object. (C:\code\next.js\examples\auth-passage-passwordless\node_modules\lint-fix\dist\bin.js:71:7)
at webpack_require (C:\code\next.js\examples\auth-passage-passwordless\node_modules\lint-fix\dist\bin.js:21:30)
at C:\code\next.js\examples\auth-passage-passwordless\node_modules\lint-fix\dist\bin.js:64:18
at Object. (C:\code\next.js\examples\auth-passage-passwordless\node_modules\lint-fix\dist\bin.js:67:10)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
I have Googled until my fingers bled, but came across nothing of help.
How do I get lint-fix up and running?

Cloudflare and next.js static exports not working?

It normally works but suddenly it stoped working and im not sure
why. If you can help thanks!
logs
2022-11-24T13:14:56.98176Z Executing user command: next build && next export
2022-11-24T13:14:57.075259Z /opt/buildhome/repo/node_modules/next/dist/build/index.js:344
2022-11-24T13:14:57.075558Z ...pageKeys.app ?? [],
2022-11-24T13:14:57.075709Z ^
2022-11-24T13:14:57.075852Z
2022-11-24T13:14:57.075978Z SyntaxError: Unexpected token '?'
2022-11-24T13:14:57.076087Z at wrapSafe (internal/modules/cjs/loader.js:1054:16)
2022-11-24T13:14:57.076193Z at Module._compile (internal/modules/cjs/loader.js:1102:27)
2022-11-24T13:14:57.0763Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2022-11-24T13:14:57.076409Z at Module.load (internal/modules/cjs/loader.js:986:32)
2022-11-24T13:14:57.076516Z at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2022-11-24T13:14:57.076621Z at Module.require (internal/modules/cjs/loader.js:1026:19)
2022-11-24T13:14:57.076736Z at require (internal/modules/cjs/helpers.js:72:18)
2022-11-24T13:14:57.076877Z at Object.<anonymous> (/opt/buildhome/repo/node_modules/next/dist/cli/next-build.js:10:37)
2022-11-24T13:14:57.077002Z at Module._compile (internal/modules/cjs/loader.js:1138:30)
2022-11-24T13:14:57.077111Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2022-11-24T13:14:57.082209Z Failed: build command exited with code: 1
2022-11-24T13:14:57.927713Z Failed: an internal error occurred
It exports the files and deploys to cloud flare
The error you are getting indicates that your Node version does not support the nullish coalescing operator, which is part of Node as of version 14.
From reading the Cloudflare docs I understand that the default Node version is 12, which would match this suspicion.
The solution then would be to update your Cloudflare configuration to use a newer version (14+) of Node (see docs).

Vercel - TypeError: Cannot read property 'system' of undefined

It looks like my build is working fine. (And build fine locally).
But I get this error when deploying to Vercel.
08:04:54.329 [4/4] Building fresh packages...
08:04:56.738 success Saved lockfile.
08:04:56.742 Done in 39.69s.
08:04:56.778 Detected Next.js version: 10.0.3
08:04:56.779 Running "yarn run build"
08:04:57.063 yarn run v1.22.10
08:04:57.106 $ next build
08:04:57.789 Browserslist: caniuse-lite is outdated. Please run:
08:04:57.790 npx browserslist#latest --update-db
08:04:57.894 info - Creating an optimized production build...
08:04:57.915 Attention: Next.js now collects completely anonymous telemetry regarding usage.
08:04:57.915 This information is used to shape Next.js' roadmap and prioritize features.
08:04:57.915 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
08:04:57.915 https://nextjs.org/telemetry
08:06:05.124 info - Compiled successfully
08:06:05.125 info - Collecting page data...
08:06:07.309 > Build error occurred
08:06:07.312 TypeError: Cannot read property 'system' of undefined
08:06:07.312 at Object.get (/vercel/workpath0/node_modules/faker/lib/index.js:75:47)
08:06:07.312 at new System (/vercel/workpath0/node_modules/faker/lib/system.js:41:44)
08:06:07.312 at new Faker (/vercel/workpath0/node_modules/faker/lib/index.js:147:17)
08:06:07.312 at Object.<anonymous> (/vercel/workpath0/node_modules/faker/locale/en_US.js:2:13)
08:06:07.312 at Module._compile (internal/modules/cjs/loader.js:1063:30)
08:06:07.312 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
08:06:07.312 at Module.load (internal/modules/cjs/loader.js:928:32)
08:06:07.313 at Function.Module._load (internal/modules/cjs/loader.js:769:14)
08:06:07.317 at Module.require (internal/modules/cjs/loader.js:952:19)
08:06:07.317 at require (internal/modules/cjs/helpers.js:88:18) {
08:06:07.317 type: 'TypeError'
08:06:07.318 }
08:06:07.468 error Command failed with exit code 1.
08:06:07.469 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
08:06:07.486 Error: Command "yarn run build" exited with 1
08:06:10.181 Done with "package.json"
As #juliomalves pointed out. It was faker's fault. It was working fine, then suddenly it wasn't. I ended up just removing it from my packages.
yarn remove faker
And just stripped it out of the project as it was just being used for demo stuff. Now all good.

Atom editor is not executing programs

Hello my atom software is not executing programs . i would love to know how i can solve this problem
::When i execute i am given the following error
[ ^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:606:28)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Function.Module.runMain (module.js:683:10)
at startup (bootstrap_node.js:196:16)
at bootstrap_node.js:622:3][1]
To execute a program in Atom I would first try downloading and installing the Script package. After installing this package, open your file and go to the packages menu. You'll see the newly installed script. Select this to run your script. See image below.
Do all your lib/*.js files have at the top this line?
'use babel';

Meteor. Cannot find module 'request'

When I try to give new commands I get errors.
[root#localhost ~]# meteor
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'request'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/usr/lib/meteor/app/meteor/deploy.js:9:15)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
This is because the node_modules are missing or the NODE_PATH is set incorrectly.
Try re-installing or debugging this, or try to create a dev_bundle instead from a git clone if the normal approach doesn't work for you...

Resources