Working from Codebox 0.8.1
Here is a Gist containing the 3 files that Codebox uses to build its editor addon.
I am on windows running virtualbox ubuntu/precise64 through vagrant in administrative cmd when running npm install all I am fine but when I run sudo npm start
I receive the following:
Building addons in ./addons/ (force=false)
Optimizing cb.files.editor
error for optimization of cb.files.editor
options= { baseUrl: 'addons/cb.files.editor',
name: 'client',
out: '/project/addons/cb.files.editor/addon-built.js',
paths: { 'require-tools': '/project/core/cb.addons/require-tools' },
optimize: 'uglify',
map:
{ '*':
{ css: 'require-tools/css/css',
less: 'require-tools/less/less',
text: 'require-tools/text/text' } } }
{ [Error: Command failed: node /project/node_modules/requirejs/bin/r.js -o baseUrl=addons/cb.files.editor name=client out=/project/addons/cb.files.editor/addon-built.js paths.requi
re-tools=/project/core/cb.addons/require-tools optimize=uglify map.*.css=require-tools/css/css map.*.less=require-tools/less/less map.*.text=require-tools/text/text (exited with e
rror code 1)]
killed: false,
code: 1,
signal: null,
stdout: '\nTracing dependencies for: client\nError: ENOENT, no such file or directory \'/project/addons/cb.files.editor/ace/ace.js\'\nIn module tree:\n client\n ace\n\nEr
ror: Error: ENOENT, no such file or directory \'/project/addons/cb.files.editor/ace/ace.js\'\nIn module tree:\n client\n ace\n\n at Object.fs.openSync (fs.js:432:18)\n\n
',
stderr: '' }
If I run npm start
(no sudo):
Running "exec:build_files_editor" (exec) task
>> npm
>>
>> WARN
>>
>> package.json
>> cb.files.editor@0.1.1 No repository field.
>> npm
>>
>> WARN
>>
>> package.json
>> cb.files.editor@0.1.1 No README data
> cb.files.editor@0.1.1 postinstall /project/addons/cb.files.editor
> ./download_ace.sh && ./build.sh
>> sh: 1:
>> ./download_ace.sh: not found
>>
>> npm ERR! weird error 127
>> npm
>> WARN This failure might be due to the use of legacy binary "node"
>> npm WARN For further explanations, please read
>> /usr/share/doc/nodejs/README.Debian
>> npm
>>
>> ERR!
>>
>> not ok
>> code 0
>> Exited with code: 1.
Warning: Task "exec:build_files_editor" failed. Use --force to continue.
Any help would be great?
After breaking the problem down, and trying to execute each shell script individually I found it was a problem with Windows line endings in my Linux VM.
The solution dos2unix by using this library I was able to convert all the files in the project to LF (Linux) line endings.
After entering the project directory all I had to do was run this command:
find . -type f -exec dos2unix {} \;
Now if I run npm start
the project compiles correctly.
For any other user encountering this problem I recommend setting up your IDE to default to LF line endings using EditorConfig.