Nextjs environment variables seem to be undefined - javascript

After creating a new next.js project with npx create-next-app#latest and adding some environment variables on .env.local file I get this error when i run the server.
"Failed to load env from .env.local TypeError: Cannot read properties of undefined (reading 'split')"
I tried 3 times to create a nextjs project and it was always happening (OS Windows 11)

Seems that the cause of the problem was that one of my .env variables included a '$' character, so the env file failed to load. Escaping the $ character with a \ solves the problem.

Related

Angular project produces javascript error "core.js:23018 Uncaught TypeError: Cannot read properties of undefined (reading 'id')"

No changes have been made to the project, since it last compiled except for upgrading VSCode
Node: 16.13.0
I am now on 1.68.1 VSCode
Angular 8.3.1 is output of -v
the exact error is above. When debugging through the section it points to, it goes through imports: [, and it complains about LoadingBarHttpClientModule, and LoadingBarRouterModule, i remove those, but then complains about NgxsRootModule , so i give up at this point, not removing that.
in core.js this is the code where it will break in console
function registerNgModuleType(ngModuleType) {
if (ngModuleType.ngModuleDef.id !== null) {
i have tried to disable Angular Language Service but in this version there is no "checkbox" to do so, so i just went to extensions and disabled it.
deleted node_modules, and npm install
restored node_modules, and npm update
restored node_modules, and just run npm install
nothing
Also ever since my development machine was created, i cannot get ng new "commands" to run to create components or modules
If i do Windows Script Host pops up saying
\AppData\Roaming\npm\node_modules#aungular\cli\bin\ng.js
line 1
char 1
invalid character
What gives
I think there is a dependency-version mismatch. You need to
1- Go to C:\Users\${your_user_name_here}\AppData\Roaming\npm and remove content manually if you are on Windows
2- Run npm ci to reinstall clean version packages
Also, you can follow this thread here since the same issue has been resolved similarly

Module not found: Can't resolve '../styles/global.css' in an next.js project

I am following the instruction on :
https://nextjs.org/learn/basics/assets-metadata-css/global-styles
And getting error message when adding import '../styles/global.css'
to _app.js
./pages/_app.js
Module not found: Can't resolve '../styles/global.css' in 'C:\Users\Owner\Documents\tradingCFD\pages'
Your global.css seems to be in public/styles., not just styles/. The styles directory should be moved up a level to be in the app root.
I was having this issue. The tutorial tells you to restart the server, do it.
Restart the Development Server
Important: You need to restart the development server when you add pages/_app.js. Press Ctrl + c to stop
the server and run:
npm run dev
If you put _app and global in the correct folders, it should run OK.
Not exactly the same problem as the OP but in my case, using styled-components createGlobalStyle, I incorrectly referenced the file as ../styles/global and it build fine locally even though the filename was Global.js. The build on Vercel wasn't so lenient.
TLDR:
double check capitalization on file refs 😅

Cannot find module 'mysql'

I went through the different proposed answers related to this problem while installing node.js mysql.
I tried about everything and I still get the same error message: "Cannot find module 'mysql'" either locally or on a webserver.
Checks I've performed:
Packages and dependencies are installed in myproject/node_modules
==> check
Run my database.js test script going into the folder and via the command line typing "node database.js" => this works
Tried to load in my HTML document the index.js file from node_modules/mysql
before loading the file database.js => ReferenceError: exports is not defined. Also tried to put database.js in the main folder, same error.
I haven't trying copying my project folder in the c:/some-dir/nodejs because it is supposed to run on a webserver.
Any clue what's the issue here?

Jupyter Notebook - Cannot read property of undefined

I have cloned Jupyter notebook from Git repository and installed it in new separate conda environment for development purposes. I have installed correctly as given in https://github.com/jupyter/notebook/blob/master/CONTRIBUTING.rst.
With 'jupyter notebook' command, it runs notebook in the browser, but opens up a blank page instead because of some javascript issues it is getting in browser console. They are:
TypeError: Cannot read property '_' of undefined(…)check #
require.js?v=f960924…:900
Uncaught TypeError: Cannot read property '_' of undefined
underscore.js:15
Failed to parse SourceMap:
http://localhost:8888/static/tree/js/built/1.main.min.js.map
I haven't modified any js code till now. I have just installed it.
How to resolve this issues?
This error is platform specific. There might be some problem on my dev-master. For windows, try following commands:
git log
git checkout 4.2.0
With these commands, you will have fresh checkout and also for webpack build. After that, try following commands:
python setup.py js
python setup.py css
This will extract all js and css dependencies. Now try:
jupyter notebook
Everything works great!

Swagger-editor don't work local refs when it installed locally

I'm new on swagger.
I've installed Swagger on Ubuntu 14.04 server two times and always get same error "Uncaught TypeError: Cannot read property 'map' of undefined" in Chrome and "TypeError: async is undefined async.map(_.keys(remoteRefs), function (refPtr, callback)" in Firefox when i'm use $ref in any kind of document, include examples.
All other functions work's fine, problem reproduce only when I try use any reference
My node version: v0.10.38
Npm versiton: 1.4.28
Swagger version is latest

Categories

Resources