Problem import script

Hello I have this problem when I install a script I contacted the developer but he doesn’t know why either, can someone help me thanks


Hi @xmassimiliano, thanks for the post and welcome.
If you have not already tried the command below kindly try it out to see if it works.

npx browserslist@latest --update-db

If the above does not work kindly try the code below based on the respective package manager you are using.

NPM

npm i npm-update-all -g

YARN

yarn upgrade

Let me know the outcome.

Thanks.

Caio the problem is that when I put the right variables the API key gives me an error I insert it I create the variable but it always gives me the error

Hello @xmassimiliano, thanks for the extra informaiton.
Note that if you want to access the environment values you have to access it using the code below

process.env.YOUR_IMPORTANT_VARIABLE_HERE

So for example based on your image you can access the environment variable using

process.env.VUE_APP_API_KEY

If the above does not help can you share how and which web framework you are using to access the environment variable.

Thanks.

The last two key names are VUE_APP_FIREBASE_MESSAGING_SENDER_ID and VUE_APP_FIREBASE_MEASUREMENT_ID.) Click Deploy site.

I also followed the developer’s guide but it doesn’t work

ERROR Failed to compile with 2 errors1:52:56 PM
2:52:56 PM: error
2:52:56 PM: Template execution failed: ReferenceError: VUE_APP_API_KEY is not defined
2:52:56 PM: ReferenceError: VUE_APP_API_KEY is not defined
2:52:56 PM: - index.html:104
2:52:56 PM: /opt/build/repo/public/index.html:104:11
2:52:56 PM: - index.html:109 0971.module.exports
2:52:56 PM: /opt/build/repo/public/index.html:109:3
2:52:56 PM: - index.js:284
2:52:56 PM: [repo]/[html-webpack-plugin]/index.js:284:18
2:52:56 PM: ERROR Build failed with errors.
2:52:56 PM: ​
2:52:56 PM: “build.command” failed
2:52:56 PM: ────────────────────────────────────────────────────────────────
2:52:56 PM: ​
2:52:56 PM: Error message
2:52:56 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
2:52:56 PM: ​
2:52:56 PM: Error location
2:52:56 PM: In Build command from Netlify app:
2:52:56 PM: npm run build
2:52:56 PM: ​
2:52:56 PM: Resolved config

Hi @xmassimiliano, a ReferenceError on VUE_APP_API_KEY and VUE_APP_API_KEY means that either the spelling of the environment variables in the dashboard are different from how it is being referenced in the source code or vice versa.

Kindly ask the developer to cross check the spelling of the environment variables in the source code with what you have also typed in the dashboard to make sure the spellings are the same.

Let me know the outcome.

Thanks.

This article may also be helpful, as it describes another situation (in addition to Clarence’s suggestion which also seems worth verifying), in which your build command “Throws away” its environment, and has some suggestions around how to debug and fix this:

(the third paragraph in particular refers to the situation I am describing).

1 Like