Cannot compile Ionic Cordova (Update 6) app on Visual Studio 2015

前端 未结 3 1538
长发绾君心
长发绾君心 2021-01-07 00:23

Recently I updated to Cordova Tools version 6 for Visual Studio I am now getting this error. Anytime I try to build my solution.

: BLD00401 : Could not find          


        
相关标签:
3条回答
  • 2021-01-07 00:30

    This appears to be a bug that we introduced in Update 6 that causes npm install errors if the path to your npm install directory (usually in your AppData folder) has a space in the path. The simple workaround is to change your npm install directory:

    npm config set prefix "C:\Folder\With\No\Spaces"

    And then build again in VS. We will get this fixed up and released in Update 7 as soon as we can.

    Sorry for the inconvenience.

    0 讨论(0)
  • 2021-01-07 00:51

    Update: a possible workaround below Many thanks to the MS team > see answer for fix until Update 7

    Update 7 is/has been released and resolves this issue (spaces in path)


    Not an answer - more like an "inventory" of attempts at getting to one.


    Environment:

    • Visual Studio 2015 (all updates)
    • Node v4.3.0
    • Npm v3.7.2

    Errors

    In any Cordova Project - existing, new (blank template, ionic template), etc.

    BLD401  Error : 
    BLD00401 : Could not find module 'C:\Users\Ed Chavez\AppData\Roaming\npm\node_modules\vs-tac\app.js'. 
    Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.
    

    Attempts

    • following the instruction to Clear Cordova Cache and rebuild does not resolve anything
    • copying the vs-tac (from original Program Files) to the folder in the error, does not resolve the issue. Each time you build your project, that copied folder is cleared/removed
    • following advice to reinstall vs-tac does not resolve the issue
    • trying to run repair Cordova Tools (my experiment) does not resolve the issue

    Possible culprit This IS the culprit: space in path

    Inspecting Output window points to what could be the issue (detail below):

    • at the point where vs-tac is being installed:

    'C:\Users\Ed' is not recognized as an internal or external command, (TaskId:10)

    which is the (my) Users folder and it contains a space between my first and last name.

    Your environment has been set up for using Node.js 4.3.0 (x64) and npm. (TaskId:10)
    ------ Ensuring correct global installation of package from source package directory: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac (TaskId:10)
    ------ Name from source package.json: vs-tac (TaskId:10)
    ------ Version from source package.json: 1.0.34 (TaskId:10)
    ------ Package not currently installed globally. (TaskId:10)
    ------ Installing globally from source package. This could take a few minutes... (TaskId:10)
    Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies. (TaskId:10)
    'C:\Users\Ed' is not recognized as an internal or external command, (TaskId:10)
    operable program or batch file. (TaskId:10)
    ------ npm install failed. Exit code: 1 (TaskId:10)
    ------ Package installation failed. Retrying... (TaskId:10)
    

    So now in search of some fix (likely must come from Microsoft)...will update as necessary


    Update: This is a workaround, NOT a fix See above

    After more tinkering, the issue is the space in your Windows User name. So if your users folder looks something like this c\users\firstName lastName\ you will be affected by this bug.

    • I created a new (local) user in Windows 10
    • username has no spaces edsf
    • Created a new blank project (vs template)
    • Build without a hitch

    Here's the portion where vs-tac is successfully installed, now with a username with no spaces (edsf)

    Your environment has been set up for using Node.js 4.3.0 (x64) and npm.
    ---skipped for brevity ---
    
    edge-cs@0.3.0 install C:\Users\edsf\AppData\Roaming\npm\node_modules\vs-tac\node_modules\edge\node_modules\edge-cs
    ...
    Success: platform check for edge.js: node.js x64 v4.3.0
    C:\Users\edsf\AppData\Roaming\npm\vs-tac-cli -> C:\Users\edsf\AppData\Roaming\npm\node_modules\vs-tac\vs-tac-cli.cmd
    
    0 讨论(0)
  • 2021-01-07 00:51

    I'd the same issue here. In my computer I'd to copy app.js from another folder:

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\Packages\vs-tac
    

    I know this is not a good solution, but worked for me.

    But in another computer here, I reinstalled with this command and worked (I closed VS prior to run this command, and started a new project):

    npm install -g "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac"
    

    Hope these notes can help you out.

    0 讨论(0)
提交回复
热议问题