I don't know where everything went wrong but at some point, my react app started showing only a blank screen. I've look into some tuto and afterward, I've realize that when I run the command npm run build, I get the following error :
Failed to compile.
The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
Related
I'm starting to learn React Native. I tried to install it from what I read from the documentation. It works flawlessly on Android. After installing the project, I run the 'xcworkspace' file in the ios folder, but I get an error.
This is the error I got => Command PhaseScriptExecution failed with a nonzero exit code
When I run the project from the console with the following code "npx react-native run-ios" I get the following error.
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'AwesomeProject' from project 'AwesomeProject')
warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'AwesomeProject' from project 'AwesomeProject')
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/omerulusoy/Library/Developer/Xcode/DerivedData/AwesomeProject-bzsmyrhehnlgrpbitthszribdkvm/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-46EB2E00018F30.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
I entered the ios folder and ran the following code 'pod deintegrate' and then this code 'pod install' but I still get the error.
I tried installing older versions of React, but this time I got different errors.
One of the errors I got => 'Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')'
I am getting errors while I run ng serve on a web pack project which I convert from non-webpack.
Non-webpack was working fine.
This is the error I am getting
styles.js:1 Uncaught SyntaxError: Cannot use 'import.meta' outside a module
I check the other answers in StackOverflow. None of them are fixing my issue.
The change which I made in the project is to move the project to a different project structure
Previously the project was the below project structure
But now I am in the current project structure.
The one highlighted in the above pic, there was my old project. In addition to this, I added another project called "project-list" which is also having the same error in the browser while I run.
I've downloaded this Phaser/MatterJS example from Codesandbox (->File ->Export to ZIP).
Running it locally returns this error:
Uncaught SyntaxError: Cannot use import statement outside a module - index.js:1
How to fix this?
What I tried so far:
I've installed all dependencies
Updated to latest NodeJS
Running it with a local server
Just as you have seen yourself the javascript that is written in the files is not something that the browsers understand out of the box, and so errors were thrown your way.
To send js that browsers understand, you need to use a tool like webpack, parcel. already in the project you shared parcel is used.
You have to do the following:
install the dependecies of the probject
in the root dir of the project run npm run start
parcel will bundle the files and then open an html page with the results
unfortunately when i tried this parcel did not work for me, there were errors related to JSON loading, however i have managed to get the game to work, by running npm run build, this will output for you the build files in a folder called dist.
Go to the dist folder, and start a local server there and visit the file it should work, however again for me it did not work. but i noticed that its due to parcel not getting the correct relative path of the bundled js file.
To solve that, open the index.html file in the dist folder, you will find that there is one script there
<script src="/js.d8530414.js"></script>
I had to change that to
<script src="./js.d8530414.js"></script> // because this was the correct file in my file system
After that visit the html file in the dist folder, and the game works fine.
Obviously this way of working is not conveninent, since for each change you want to see you have to build the project again using npm run build. You need to solve the problem of npm run start not working, it could be that this problem never occurs to you if you are on different os than mine. If it happens then i suggest updating parcel and trying again, if problem still persists, then you can look here since issue seems related to phaser wanting the json file as json, while parcel compiling it to javascript object.
index.html:
<script type = "module" src = "./js/index.js">
You have to tell the browser that this js file is a module, then it will change some things on the backside for you to use this. This article is very helpful for getting started with modules.
Im using ember to develop a project.
Please help me with this error. Im unable to run my project on local. After hitting
ember server the build is successful. But on hitting the http://localhost:4200
Loads empty page with console error.
Uncaught Error: Assertion Failed: The initializer 'App Version' has already been registered
at assert (index.js:172)
at Function.initializer (index.js:420)
at registerInitializers (index.js:27)
at loadInitializers (index.js:68)
at Module.callback (app.js:25)
at Module.exports (loader.js:106)
at requireModule (loader.js:27)
at app-boot.js:3
Unable to understand what to do. Any help regarding this would be appreciated.
I did a code search to see where that initializer might exist and it looks to be part of ember-cli-app-version.
In your place I would remove ember-cli-app-version from your app with npm uninstall --save-dev ember-cli-app-version and then run ember serve again. The purpose of this addon is to make it easy to see your app's version number in the ember inspector, but that's not a big deal so removing it won't break anything and should get you moving forward.
If you want to investigate the issue further try searching your code base (including node_modules) for App Version to see where a duplicate exists.
Running npm install solved the problem.
The actual issue was due to the iCloud sync being active in my Macbook.
Turning iCloud sync off should solve the problem.
I want to make an app in ionic, so I add some custom page in ionic by command :
ionic g page user
But I start ionic server it show error
Runtime Error Cannot find module "../pages/home/home"
click for error image
If the app tells you that it misses a file, that's because there's somewhere where you imported this file and it doesn't exist (anymore? maybe you deleted it and forgot to delete an import)
You should make a project-wide text search using grep or your favorite ide to find where you are importing "../pages/home/home".
Your error doesn't come from your ionic g page user command as this command only generates a page named user.
It seems like you created a page called home and deleted it without deleting imports.
I encountered the same problem when I was github clone code.
But this is not the problem with the code itself, but because I used cnpm (npm of the Chinese version).
Uninstall npm, install npm. The problem is solved