Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

npm ERR! install Couldn't read dependencies #81

Open
amicos opened this issue Jun 8, 2015 · 13 comments
Open

npm ERR! install Couldn't read dependencies #81

amicos opened this issue Jun 8, 2015 · 13 comments

Comments

@amicos
Copy link

amicos commented Jun 8, 2015

I have this issue when i do : mvn install

npm ERR! install Couldn't read dependencies

ERR! errno -4058

ERR! package.json ENOENT, open 'C:\workspace\MyProject\package.json'
ERR! package.json This is most likely not a problem with npm itself.
ERR! package.json npm can't find a package.json file in your current directory

My Pom File:

 <build>    
       <plugins>
             <plugin>
                    <groupId>pl.allegro</groupId>
                <artifactId>grunt-maven-plugin</artifactId>
             <version>1.5.0</version>
             <configuration>
                  <jsSourceDirectory>${basedir}/src/main/webapp/app</jsSourceDirectory>
                <sourceDirectory>${basedir}/src/main/webapp</sourceDirectory>
                <npmEnvironmentVar>
                    <PHANTOMJS_CDNURL> http://cnpmjs.org/downloads
                                            </PHANTOMJS_CDNURL>
                </npmEnvironmentVar>
                <filteredResources>
                    <filteredResource>maven-properties.json</filteredResource>
                </filteredResources>
                <workingDirectory>${basedir}/src/main/webapp</workingDirectory>
                </configuration>
            <executions>
                <execution>
                    <id>test-angular</id>
                    <phase>test</phase>
                    <configuration>
                        <target>test</target>
                    </configuration>
                    <goals>
                        <goal>create-resources</goal>
                        <goal>npm</goal>
                        <goal>grunt</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>${basedir}/src/main/webapp/dist</directory>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

    </plugins>
</build>

how to specify the path of package.json and gruntfile to the plugin because my pom isnt in the same repesitory (the pom is in the default root of project and all the others files are in webapp)? who can help me please?

@amicos
Copy link
Author

amicos commented Jun 9, 2015

I'm stuck on it

@adamdubiel
Copy link
Collaborator

Can you show tree of your project? and mark where you need your package.json to reside in.

@amicos
Copy link
Author

amicos commented Jun 9, 2015

The tree of my project:
MyProject
├── src
------├── main
------------├──webapp
------------------├──app
------------ -----------├──projects scripts and files
------------------------├── index.html
------------------├──dist
------------------├── test
------------------├──WEB-INF
------------------├── GruntFile.js
------------------├──package.json
├──pom.xml

I want my pom to build my project to have in final the war

@adamdubiel
Copy link
Collaborator

I guess the formatting is wrong - can you edit it so i can see the indentations?

@adamdubiel
Copy link
Collaborator

Okay, i guess you need to add some more formatting to your pom as well, as i can't see the whole.

@amicos
Copy link
Author

amicos commented Jun 9, 2015

I do it

@adamdubiel
Copy link
Collaborator

Okay, sto there are two problems:

  • jsSourceDirectory is relative to sourceDirectory, so you should not put the whole there, app would be enough
  • GruntFile.js and package.json need to be present in jsSourceDirectory

@amicos
Copy link
Author

amicos commented Jun 9, 2015

I modify the Pom :

< jsSourceDirectory> ${basedir}/src/main/webapp </ jsSourceDirectory>

but I have this issue :

error errno -4058
error package.json ENOENT, open 'C:\workspace\JcdstreamIhm\target-grunt\package.json'
error package.json This is most likely not a problem with npm itself.
error package.json npm can't find a package.json file in your current directory.
verbose exit [ -4058, true ]

@adamdubiel
Copy link
Collaborator

I don't know what did you change - can you shod the relevant bits?

@amicos
Copy link
Author

amicos commented Jun 9, 2015

< jsSourceDirectory> ${basedir}/src/main/webapp </ jsSourceDirectory>

in the webapp I have the GruntFile.js and package.json

@adamdubiel
Copy link
Collaborator

As i mentioned earlier, jsSourceDriectory should contain relative path, just change it it app - if your gruntfile and package.json are in app.

@amicos
Copy link
Author

amicos commented Jun 9, 2015

Ok I use the relative path. I want to build my project and generate the war. do you think the goals I used are enough to reach my target.
Thanks

@adamdubiel
Copy link
Collaborator

If your configuration (i.e. npm works) is okay, that should be enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants