Browserify working in some folders in windows, but not others

I'm trying to setup a build flow in a Visual Studio environment (13, on Windows 7) using browserify, and I am getting some strange behaviour trying to get browserify to work. I'm new to the environment as well as the technology, so I'm fairly confused here.

For the purposes of this test, my file structure is the same as the Basic API example found here: http://viget.com/extend/gulp-browserify-starter-faq I installed browserify using npm. It is running version 5.12.0

If I place app.js and hideElement.js in a simple directory, such as C:Temp, and run

c:Temp> browserify app.js

everything works fine. It bundles up all three of the required files, and spits them out. But if I run the browserify command from my project directory (C:Usersdocumentsvisual studio 2013ProjectsExcelConverterExcelConverterWeb), the following error spits out at me:

C:Users<name.redacted>DocumentsVisual Studio 2013ProjectsExcelConverterExcelConverterWeb>browserify app.js
Error: SyntaxError: Unexpected token ? while parsing json file package.json
    at fns(C:Users<name.redacted>AppDataRoamingnpmnode_modulesbrowserifynode_modulesmodule-depsindex.js:402:30)
    at fs.js:271:14
    at Object.oncomplete (fs.js:107:15)

I've looked at the file in question, and I can't make heads or tails of it. So, what's going on here? How come browserify runs fine when I execute it from one directory, but not from the other? I appear to be using the same executable.

(I'm trying to use browserify as part of a gulp-based build process, but seeing as the errors produced by gulp are basically the same as those I see when I run from the command line)


I have run into "Unexpected token ?" problem. Changing package.json encoding type to 'ANSI' helped solving it. Most of the text editors have that option when "Save As" change Encoding option, then hit "Save"

See if that work for you.

链接地址: http://www.djcxy.com/p/32888.html

上一篇: 在使用browserify时需要返回空对象

下一篇: Browserify在Windows中的某些文件夹中工作,但不是其他人