EDIT: Answered, below.
Also: If you are reading this you are probably new to web dev and you should consider using webpack for this instead of babel alone
I have what seems like a very simple problem but I can't solve it.
I have a directory structure
Project
|
+-- scripts
|
|
+-- src / src.js
|
|
+-- compiled / compiled.js
And I have been trying to get the following command to work when my terminal is located in the scripts folder.
C:\Users\me\JavaScriptProjects\survey\scripts>npx babel ./src/src.js --out-file ./compiled/compiled.js presets=env,react --watch
But it simply keeps returning:
C:\Users\me\JavaScriptProjects\survey\scripts>npx babel ./src/src.js --out-file ./compiled/compiled.js presets=env,react --watch
presets=env,react doesn't exist
I have tried permutations of removing the ./, replacing it with only /, going into src dir and replacing src/src.js with src.js and then doing ../compiled/compiled.js and many other permutations, but it just keeps saying it doesn't exist.
Even if I add both files to the same directory it's giving the same error.
Most annoying part is it was working fine yesterday.
Thanks in advance.
Solved.
The following has worked from within the src dir after trying for around an hour. I don't know what I've done differently, would love it if someone can point it out.
Thanks.
C:\Users\me\JavaScriptProjects\survey\scripts\src>npx babel src.js --out-file=../compiled/compiled.js --presets=env,react --watch
It could be that you have a babel.config.json file in the \scripts\src folder and that if you move to the \scripts folder to run npx, then it can't see the config file and so doesn't see react.
Project
|
+-- scripts
|
+-- src / src.js
+-- src / babel.config.json
|
+-- compiled / compiled.js
Related
We have our ARM templates in a build folder alongside our code. In our pipeline we publish our build folder as an artefact. We have master templates.
We want to run our ARM templates from a Release Pipeline, however our master templates can't find our linked templates, we get the following errors:
##[error]InvalidTemplateSpec: The relative path 'arm-kv/1.0.0.0/azuredeploy.json' could not be resolved. Please ensure the parent deployment references either an external URI or a template spec ID. The relativePath property cannot be used when creating a template deployment with a local file.
The folder structure of the created artefact is as follows;
Builds/
+-- ARM/
+-- parameters/
| +-- azuredeploy-rg-parameters.json ## parameters file
|
+-- arm-kv
| +-- 1.0.0.0/
| +-- azuredeploy.json ##(linked key vault template)
|
|- arm-storage
| +-- 1.0.0.0/
| +-- azuredeploy.json ##(linked storage template)
|
+-- azuredeploy-rg.json ##(main template)
What is the correct syntax for referencing the subfolder/templates? We've tried
arm-kv/1.0.0.0/azuredeploy.json (relative path)
./arm-kv/1.0.0.0/azuredeploy.json
/builds/arm/arm-kv/1.0.0.0/azuredeploy.json (the full artefact path)
When you run the task you are probably in the $(System.DefaultWorkingDirectory) context. This is the folder where artifacts are downloaded. Please check what you have exacelty there by adding a step and listing files.
Once you have it change your working directory for your ARM deployment step to $(System.DefaultWorkingDirectory)/builds/arm (it could be slightly different and this is why former step is needed to verify the path). Once you set it correctly you will get azuredeploy-rg.json in the root and all linked templates will become discoverable.
Ive been having the "No such file or directory" issue for quite some time in PlatformIO extension with VScode when its never been an issue in Visual Studio. (not VScode)
My project setup is as follows:
MyProject
|--include
| |--config.h
|--lib
| |--LibraryA
| | |--libraryA.h
| | |--libraryA.cpp
| |--LibraryB
| | |--libraryB.h
| | |--libraryB.cpp
|--src
| |--main.cpp
Now, if I include config.h in main.cpp all is well. But if I include config.cpp in LibraryA/B.h or LibraryA/B.cpp I get the "No such file or directory" compiling error.
Why is this? If I right click #include "config.h" and select "Go to References" it takes me to the config file, or I can "Tab" autocomplete when typing in config.h it does so successfully too. So it knows the header file exists. Why can the linker not find it?
Any help would be greatly appreciated.
Thank you
I finally found the solution. All files in src and include folders are not global. The linker cannot know of the existence of these files, even if intellisense (which is not the same as the linker - which is not the same to the compiler) knows its reference.
To solve this problem add the following line to the platform.ini file.
build_flags = -I include
This will make the content of the include folder visible
I just upgraded to Eclipse 2020-09 (4.17.0) on OS X 10.13.
I have a large existing repository of java projects and I've installed the javascript and GWT plugins for Eclipse.
The problem is this: whenever I do almost anything (ex. save a file I'm working on), I get an error:
An error has occurred. See error log for more details. Path must include project and resource name: /.gitignore
specifically, the error comes from jface:
Problems occurred when invoking code from plug-in: "org.eclipse.jface".
the top of the error code is:
java.lang.IllegalArgumentException: Path must include project and resource name: /.gitignore
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2128)
at org.eclipse.core.internal.resources.Container.getFile(Container.java:196)
at org.eclipse.egit.ui.internal.staging.StagingViewContentProvider.getFile(StagingViewContentProvider.java:139)
at org.eclipse.egit.ui.internal.staging.StagingEntry.getFile(StagingEntry.java:213)
at org.eclipse.egit.ui.internal.staging.StagingEntry.getProblemSeverity(StagingEntry.java:244)
at org.eclipse.egit.ui.internal.decorators.ProblemLabelDecorator.decorateImage(ProblemLabelDecorator.java:84)
at org.eclipse.jface.viewers.DecoratingLabelProvider.getImage(DecoratingLabelProvider.java:101)
But, there's a .gitignore in both the repo root and the project root and the project path settings are:
PARENT_LOC /Users/brian/git/JavaCodeFromSVN
PROJECT_LOC /Users/brian/git/JavaCodeFromSVN/jsAipotu
WORKSPACE_LOC /Users/brian/git/JavaCodeFromSVN
So I can't figure out what the problem is or how to fix it.
I can work in eclipse but it's really annoying to get these messages all the time.
I'm sure it's something obvious but I'm just not seeing it.
Might anyone be able to help? It seems that every time I upgrade Eclipse, it's a headache of one kind or another. Perhaps, someday, I'll learn my lesson and not upgrade :(
thanks
Brian
I think I may have fixed the problem. Here's what I did that made this go away.
Right-click the project: Team -> advanced -> Clean... and let it clean all it found (lots of .gitignores etc)
At that point, I was getting warnings about .DS_Store pretty consistently.
I followed the directions at https://intellipaat.com/community/9089/how-can-i-remove-dsstore-files-from-a-git-repository-gitignore-dsstore (By Debashis Borgohain)
they are:
Remove existing .DS_Store files from the repo. In the top level repo directory:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
Create or update the .gitignore file at the top of the repo to contain a listing for .DS_Store. WHen set like this, even if Mac OS re-creates the .DS_Store files, they will be ignored by git when you commit changes, etc. Here is one way:
echo .DS_Store >> .gitignore
Commit the revised .gitignore
git add .gitignore
git commit -m '.DS_Store banished!'
to get rid of all the .DS_Store files, tell git to ignore them, and now it seems happy.
I got this error because I have a Maven project with sub-projects, and I made my Maven (base) project folder equal to the workspace folder:
π eclipse-workspace = maven base project folder = root of Git repo
+-- π subproject_1
| +-- π pom.xml (of subproject)
+-- π subproject_2
| +-- π pom.xml (of subproject)
+-- π pom.xml (of base project)
The first error was, that the base project could not be imported as a project. I thought this was meaningless, since the base project doesnβt contain code in my case, it is only a container. However, it seems Eclipse requires the base project to be a folder in the workspace:
π eclipse-workspace
+-- π project (base project) = root of Git repo
+-- π subproject_1
| +-- π pom.xml (of subproject)
+-- π subproject_2
| +-- π pom.xml (of subproject)
+-- π pom.xml (of base project)
I am trying to build the java projects with gradle and my project structure something like below:
Root
|
|----Child
| |
| Child1 (build.gradle)
|
|
|----Child12
| |
| Child111
| |
| Child222(build.gradle)
|
settings.gradle
As you can see, the project structure, here I am doing the gradle eclipse build for all the projects (Child1, Child222) in a single attempt by modifying settings.gradle and including the child projects something like below:
include 'Child/Child1'
include 'Child12/Child111/Child222'
Build is fine with that.
Whereas, while importing the projects(Child1, Child222) into eclipse, I am getting the following error:
Creation Problems
Path for project must have only one segment.
Because, in the Child1 .project file
<projectDescription>
<name>Root/Child1</name>
<projectDescription>
project name appearing as Root/Child1, instead of Child1.
Is there anyway, with that I can import the projects into the eclipse?
I got it, I changed settings.gradle file like below:
include 'Child:Child1'
include 'Child12:Child111:Child222'
It's working fine for me.
I've been working on an Eclipse plug-in project for a while now, and I've run into a situation where I need to split the project up to seperate the test cases from the plug-in package. I'm using git as version control.
To describe this simply, I'm versioning the old project like this:
workspace/
|
+-- myplugin/
|
+-- .git/ <-- Here be the git repository
|
+-- /* Source code, project stuff, etc. */
β¦and I'm in the situation where I need to work the plugin tests in a seperate project (so that jUnit won't be needed as a required bundle with the plugin). And I'd like the repository to version everything in the workspace. Like this:
workspace/
|
+-- .git/ <-- The repository should be relocated here insteadβ¦
|
+-- myplugin/
| |
| +-- /* Source code, project stuff, etc. */
|
+-- myplugin-test/
|
+-- /* Unit tests and stuff⦠*/
Is there a simple way to do this without losing the history of the old project?
Here's the workflow in pseudocode:
cd workspace/myplugin
mkdir myplugin
git mv * myplugin # you might need to do that for all files/folders manualy
mkdir myplugin-test
# move/add files to myplugin-test
git commit -a -m "Reorganization"
cd workspace
mv myplugin myplugin_old
mv myplugin_old/* .
# you should end up with requested structure